using Microsoft.VisualStudio.TestTools.UnitTesting;
using DateTime;
namespace UnitTestDateTime
{
[TestClass]
class UnitTestDate
{
[TestMethod]
public void TestDayOfTheWeek()
{
Date date = new Date(1, 27, 2019);
Assert.AreEqual("Sunday", date.DayOfTheWeek());
}
}
}
using DateTime;
namespace UnitTestDateTime
{
[TestClass]
class UnitTestDate
{
[TestMethod]
public void TestDayOfTheWeek()
{
Date date = new Date(1, 27, 2019);
Assert.AreEqual("Sunday", date.DayOfTheWeek());
}
}
}
[1/27/2019 9:18:19 AM Informational] ------ Discover test started ------
[1/27/2019 9:18:23 AM Warning] [MSTest][Discovery][C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\bin\Debug\netcoreapp2.1\UnitTestDateTime.dll] UTA001: TestClass attribute defined on non-public class UnitTestDateTime.UnitTestDate
[1/27/2019 9:18:23 AM Warning] No test is available in C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\bin\Debug\netcoreapp2.1\UnitTestDateTime.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[1/27/2019 9:18:24 AM Warning] No test is available in C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\UnitTestDateTime.csproj. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[1/27/2019 9:18:24 AM Informational] ========== Discover test finished: 0 found (0:00:05.451639) ==========
[1/27/2019 9:18:24 AM Informational] ------ Run test started ------
[1/27/2019 9:18:26 AM Warning] [MSTest][Discovery][C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\bin\Debug\netcoreapp2.1\UnitTestDateTime.dll] UTA001: TestClass attribute defined on non-public class UnitTestDateTime.UnitTestDate
[1/27/2019 9:18:26 AM Warning] No test is available in C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\bin\Debug\netcoreapp2.1\UnitTestDateTime.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[1/27/2019 9:18:27 AM Warning] No test is available in C:\Users\tjmad\source\repos\DateTime\DateTime\DateTime.csproj C:\Users\tjmad\source\repos\DateTime\UnitTestDateTime\UnitTestDateTime.csproj. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[1/27/2019 9:18:27 AM Informational] ========== Run test finished: 0 run (0:00:03.1466992) ==========
The solution was simple. The class needed to be public.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DateTime;
namespace UnitTestDateTime
{
[TestClass]
public class UnitTestDate
{
[TestMethod]
public void TestDayOfTheWeek()
{
Date date = new Date(1, 27, 2019);
Assert.AreEqual("Sunday", date.DayOfTheWeek());
}
}
}
using DateTime;
namespace UnitTestDateTime
{
[TestClass]
public class UnitTestDate
{
[TestMethod]
public void TestDayOfTheWeek()
{
Date date = new Date(1, 27, 2019);
Assert.AreEqual("Sunday", date.DayOfTheWeek());
}
}
}
No comments:
Post a Comment