My background is Oracle development but I'm learning C#/.NET - very brand new. I'm going through a tutorial and am getting an error message. I'm using a MacBookPro (to which I am also new), VS2019 Free/Community(?) version, and trying to run some tests using "MSTest Project". I got the same error using "xUnit Test Project". Please forgive if I'm using the wrong terminology.
My tiny little project builds with no errors. I'm using 'Run All' under Unit Tests to run the tests. When testing a static method, the test runs fine. However, when testing a property, I get a pop-up box that starts with "dotnet quit unexpectedly" and includes a whole bunch (like pages and pages) of information about the error that might make sense to someone. I have not found any answers on google that involve intermittent causes (usually it's on building or running after an upgrade or something like that).
Here are my two tests:
[TestMethod] public void FullNameTestValid() { //--Arrange Customer customer = new Customer { FirstName = "Bilbo", LastName = "Baggins" }; string expected = "Baggins, Bilbo"; //--Act string actual = customer.FullName; //--Assert Assert.AreEqual(expected, actual); } [TestMethod] public void StaticTest() { //--Arrange var c1 = new Customer(); c1.FirstName = "Bilbo"; Customer.InstanceCount += 1; var c2 = new Customer(); c2.FirstName = "Frodo"; Customer.InstanceCount += 1; var c3 = new Customer(); c3.FirstName = "Rosie"; Customer.InstanceCount += 1; //--Act //--Assert Assert.AreEqual(3, Customer.InstanceCount); }
As soon as I figure out how to create a text document on a Mac, I will attach the contents of the error message. Besides the error message, please let me know what additional information is needed to investigate this problem.