Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

nchikanov
Copy link
Contributor

@nchikanov nchikanov commented Aug 2, 2017

Integrated new tests as well as existing tests from Mono.
Still going through and adding tests, this is initial PR.

Re: #22803

@nchikanov nchikanov added this to the 2.1.0 milestone Aug 2, 2017
@nchikanov nchikanov self-assigned this Aug 2, 2017
@nchikanov nchikanov changed the title Add tests to System.Data.DataSetExtensions Add initial tests to System.Data.DataSetExtensions Aug 2, 2017
Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two of the files can probably be reverted. Other than that it looks good.

{
[Fact]
public void AsEnumerable_NullSource_ThrowsArgumentNullException()
public void Where_ThrowsArgumentNull()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in here look to be the same as what @hughbe added, just ordered differently. You should be able to revert this file.

public class DataTableExtensionsTests
{

[Fact]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks like it is just split out differently.

@@ -0,0 +1,279 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
Copy link
Member

@stephentoub stephentoub Aug 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe for files originating from Mono, we need to exclude this 2nd line of the standard header (but keep the 1st and 3rd). @JeremyKuhne can confirm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct- sorry, missed that.

{
DataRowComparer<DataRow> c1 = DataRowComparer.Default;
DataRowComparer<DataRow> c2 = DataRowComparer.Default;
Assert.Equal(c1, c2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect these to just be equal or to actually be the same exact object? If the latter, we can tighten this assert by using Assert.Same instead of Assert.Equal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be Assert.Same

// LAMESPEC: .NET fails here
DataRow r3 = dt.Rows.Add (new object [] {"foo", "baz"});
Assert.IsFalse (c.GetHashCode (r1) == c.GetHashCode (r3), "#4");
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete commented out regions like this?

Assert.Null(ex.InnerException);
// #4
Assert.NotNull(ex.Message);
// #5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the value of these "// #somenumber" comments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't want to change much from the Mono source, presumably this was in their sources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were using NUnit before and the commands looked like...
Assert.IsNull(ex.InnerException, "#3") for example.

I can delete the comments if we think they are unnecessary

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're unnecessary as comments. The value of having them as strings in the assert call is that they'd be traced out as part of a failing assert, so you could search for that string and find the failing line, but as comments, they don't serve that purpose.


[Fact]
// no error for empty table this time.
// [Category("NotWorking")] // some DataTableReader internal issues
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete comments like this?

// Assert.Equal(1, dv[0]["ID"]);
// // #2
// Assert.Equal(4, dv[1]["ID"]);
//}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out because the APIs it needs don't exist? If so, can we just delete it? Or if we expect to add the APIs, could we tag this with a TODO and associated issue number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed this. AsDataView is one of the APIs that no longer exists on this library due to reliance on InternalsVisibleTo, so for now I'll remove it.

select new {
StudentID = line.Field<int> ("ID"),
StudentName = line.Field<string> ("Name"),
StudentScore = line.Field<int> ("Score") };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the whole query should be indented

Assert.True(false, "should match only one raw");
// #1
Assert.Equal(100, ql.StudentScore);
iterated = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the body of the foreach should be indented. The brace after the foreach should also be on its own line.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding all of these.

t-nichik added 3 commits August 4, 2017 09:32
XML will automatically compile when moved to right location that is in
the project, not on local desktop.

Add tests for TypedTableBaseExtensions and
EnumerableRowCollectionExtensions
@nchikanov nchikanov dismissed JeremyKuhne’s stale review August 7, 2017 23:46

Reverted files back to originals

@danmoseley
Copy link
Member

@nchikanov when you are ready, you can invoke @stephentoub for a final review.

@danmoseley
Copy link
Member

@nchikanov if you like you can check code coverage (instructions) to see whether your tests miss anything interesting.

@nchikanov
Copy link
Contributor Author

@danmosemsft Read my mind! Just sent Stephen a Skype message about this beforehand. I'll take a look tomorrow 👍

@stephentoub
Copy link
Member

I'll take a look tomorrow

Basically, instead of doing:

msbuild /t:rebuildandtest

to run the tests, add /p:Coverage=true, e.g.

msbuild /t:rebuildandtest /p:Coverage=true

The resulting coverage report will be available in bin\tests\coverage\index.htm.

@stephentoub
Copy link
Member

you can invoke @stephentoub for a final review.

😄

So tests can find doc
@nchikanov
Copy link
Contributor Author

@dotnet-bot test Linux x64 Release Build

@weshaggard
Copy link
Member

test Linux x64 Release Build

1 similar comment
@nchikanov
Copy link
Contributor Author

test Linux x64 Release Build

@nchikanov
Copy link
Contributor Author

@stephentoub I think we're ready for final review 😄

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@stephentoub stephentoub merged commit 73f62d0 into dotnet:master Aug 9, 2017
@nchikanov nchikanov deleted the addTestsSDE branch August 9, 2017 17:15
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* Add tests from mono and more to existing tests

* Clean up tests for Mono

* Fix up some tests, add necessary XML file

* Add more tests, add XML to correct location

XML will automatically compile when moved to right location that is in
the project, not on local desktop.

Add tests for TypedTableBaseExtensions and
EnumerableRowCollectionExtensions

* Fix path of testdataset1.xml

So tests can find doc


Commit migrated from dotnet/corefx@73f62d0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants