Skip to content

Update test library for VS 2019 #16371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 24, 2019
Merged

Update test library for VS 2019 #16371

merged 11 commits into from
Dec 24, 2019

Conversation

mairaw
Copy link
Contributor

@mairaw mairaw commented Dec 21, 2019

Contributes to #16046

@mairaw mairaw self-assigned this Dec 21, 2019
@dotnet-bot dotnet-bot added this to the December 2019 milestone Dec 21, 2019
@mairaw mairaw changed the base branch from master to vs-2019 December 21, 2019 02:50
Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

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

LG with a couple suggestions.


[!code-csharp[Test#1](~/samples/snippets/csharp/getting_started/with_visual_studio_2017/testlib1.cs)]
[!code-vb[Test#1](~/samples/snippets/core/tutorials/vb-library-with-visual-studio/testlib.vb)]

Note that your test of uppercase characters in the `TestStartsWithUpper` method includes the Greek capital letter alpha (U+0391) and the Cyrillic capital letter EM (U+041C), and the test of lowercase characters in the `TestDoesNotStartWithUpper` method includes the Greek small letter alpha (U+03B1) and the Cyrillic small letter Ghe (U+0433).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Note that your test of uppercase characters in the `TestStartsWithUpper` method includes the Greek capital letter alpha (U+0391) and the Cyrillic capital letter EM (U+041C), and the test of lowercase characters in the `TestDoesNotStartWithUpper` method includes the Greek small letter alpha (U+03B1) and the Cyrillic small letter Ghe (U+0433).
The test of uppercase characters in the `TestStartsWithUpper` method includes the Greek capital letter alpha (U+0391) and the Cyrillic capital letter EM (U+041C). The test of lowercase characters in the `TestDoesNotStartWithUpper` method includes the Greek small letter alpha (U+03B1) and the Cyrillic small letter Ghe (U+0433).

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I would replace the letter names with the actual characters, which can be copied from the code. Cyrillic "М" is not commonly referred to as "EM" and "г" is not referred to as "Ghe".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would people understand what we're trying to convey in that sentence if I simply use the actual characters? I'll keep the original for now but happy to change if you think that's better.

Suggested change
Note that your test of uppercase characters in the `TestStartsWithUpper` method includes the Greek capital letter alpha (U+0391) and the Cyrillic capital letter EM (U+041C), and the test of lowercase characters in the `TestDoesNotStartWithUpper` method includes the Greek small letter alpha (U+03B1) and the Cyrillic small letter Ghe (U+0433).
The test of uppercase characters in the `TestStartsWithUpper` method includes Α and М. The test of lowercase characters in the `TestDoesNotStartWithUpper` method includes α and г.

Copy link
Contributor

@tdykstra tdykstra left a comment

Choose a reason for hiding this comment

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


> [!NOTE]
> In addition to an MSTest Test project, you can also use Visual Studio to create an xUnit test project for .NET Core.
> In addition to an MSTest, you can also create xUnit and nUnit test projects for .NET Core in Visual Studio.
Copy link
Contributor

Choose a reason for hiding this comment

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

This note suggests you might want to add multiple test projects using different frameworks. It would be more helpful if it gave some clues as to why you might want to do that. That goes beyond the scope of this PR, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point and I couldn't find this info in any of our docs here for .NET or VS. Something for us to consider later.


[!code-csharp[Test#1](~/samples/snippets/csharp/getting_started/with_visual_studio_2017/testlib1.cs)]
[!code-vb[Test#1](~/samples/snippets/core/tutorials/vb-library-with-visual-studio/testlib.vb)]

Note that your test of uppercase characters in the `TestStartsWithUpper` method includes the Greek capital letter alpha (U+0391) and the Cyrillic capital letter EM (U+041C), and the test of lowercase characters in the `TestDoesNotStartWithUpper` method includes the Greek small letter alpha (U+03B1) and the Cyrillic small letter Ghe (U+0433).
Copy link
Contributor

Choose a reason for hiding this comment

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

Also I would replace the letter names with the actual characters, which can be copied from the code. Cyrillic "М" is not commonly referred to as "EM" and "г" is not referred to as "Ghe".

@mairaw
Copy link
Contributor Author

mairaw commented Dec 24, 2019

Didn't know about that extension to add the border. Really neat @tdykstra!

@mairaw mairaw merged commit 005ea7f into dotnet:vs-2019 Dec 24, 2019
@mairaw mairaw deleted the test-lib branch December 24, 2019 09:40
Copy link

@AbhitejJohn AbhitejJohn 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 fixing this. Added a few comments. Also tagging @kendrahavens.


![Visual Studio code window for the unit test project class and method - C#](./media/testing-library-with-visual-studio/unit-test-editor-window.png)
```csharp

Choose a reason for hiding this comment

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

Should we call out in plain text that this would be generated for C# and the below for VB just to make things clear?


1. In the **Add New Project** dialog, select the **Visual C#** node. Then select the **.NET Core** node followed by the **MSTest Test Project (.NET Core)** project template. In the **Name** text box, enter "StringLibraryTest" as the name of the project. Select **OK** to create the unit test project.
1. On the **Add a new project** page, enter **mstest** in the search box. Choose **C#** or **Visual Basic** from the Language list, and then choose **All platforms** from the Platform list. Choose the **MsTest Test Project (.NET Core)** template, and then choose **Next**.

Choose a reason for hiding this comment

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

We'd perhaps also want to include F# as well? In which case we'd want to change the samples below. Maybe in another PR. @kendrahavens, thoughts? I could put one out after this goes in.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should list F#. I believe in the past, we did not have F# test templates so we didn't list it.
Since there is no VB sample, I don't think we need to add a F# sample. I don't want to overwhelm the page.


[!code-csharp[Test#1](~/samples/snippets/csharp/getting_started/with_visual_studio_2017/testlib1.cs)]
[!code-vb[Test#1](~/samples/snippets/core/tutorials/vb-library-with-visual-studio/testlib.vb)]

Choose a reason for hiding this comment

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

Anyone know where these links point to? They appear to be broken today.

@@ -165,13 +143,13 @@ Your test run had no failures, but change it slightly so that one of the test me

![Test Explorer window with failing tests](./media/testing-library-with-visual-studio/failed-test-window.png)

1. In the **Failed Tests** section, select the failed test, `TestDoesNotStartWith`. The **Test Explorer** window displays the message produced by the assert: "Assert.IsFalse failed. Expected for 'Error': false; actual: True". Because of the failure, all strings in the array after "Error" were not tested.
1. Select the failed test, `TestDoesNotStartWith`. The **Test Explorer** window displays the message produced by the assert: "Assert.IsFalse failed. Expected for 'Error': false; actual: True". Because of the failure, all strings in the array after "Error" were not tested.

Choose a reason for hiding this comment

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

nit: Select the failed test, TestDoesNotStartWith, under the Failed Tests section - to make it more explicit that there is a separate grouping for failed tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants