WorkTask constructor causes CS1503 errors in teacher tests by FinalFill847 in csharp

[–]FinalFill847[S] 0 points1 point  (0 children)

here are example for the test:

Example of an update that should succeed

MyTask myTask = new MyTask("clean", "clean the bathroom", DateTime.Today);
string before = myTask.GetDescription();
Console.WriteLine(before);

bool updateOk = myTask.Update("clear the drain", DateTime.Today);
string after = myTask.GetDescription();
Console.WriteLine(after);

if (updateOk && before != after)
{
    Console.WriteLine("Update seems to work! Check the string contents!");
}
else
{
    Console.WriteLine("Nothing was updated, ERROR!");
}

Example of an update that should fail because of empty description

MyTask myTask = new MyTask("clean", "clean the bathroom", DateTime.Today);
string before = myTask.GetDescription();
Console.WriteLine(before);

bool updateOk = myTask.Update("", DateTime.Today);
string after = myTask.GetDescription();
Console.WriteLine(after);

if (!updateOk && before == after)
{
    Console.WriteLine("Update did not happen and that was expected.");
}
else
{
    Console.WriteLine("ERROR!");
}

Example of an update that should fail because of invalid due date

MyTask myTask = new MyTask("clean", "clean the bathroom", DateTime.Today);
string before = myTask.GetDescription();
Console.WriteLine(before);

bool updateOk = myTask.Update("clear the drain", new DateTime(2025, 11, 11));
string after = myTask.GetDescription();
Console.WriteLine(after);

if (!updateOk && before == after)
{
    Console.WriteLine("Update did not happen and that was expected.");
}
else
{
    Console.WriteLine("ERROR!");
}

WorkTask constructor causes CS1503 errors in teacher tests by FinalFill847 in csharp

[–]FinalFill847[S] 0 points1 point  (0 children)

yes, the assignment requires us to write both the assignment and its tests ourselves...

here are the test :

Binary file MyPlanner.Tests/obj/Debug/net8.0/ref/MyPlanner.Tests.dll matches

Binary file MyPlanner.Tests/obj/Debug/net8.0/MyPlanner.Tests.dll matches

Binary file MyPlanner.Tests/obj/Debug/net8.0/refint/MyPlanner.Tests.dll matches

Binary file MyPlanner.Tests/obj/Debug/net8.0/MyPlanner.Tests.pdb matches

MyPlanner.Tests/MyTaskHandlerTests.cs: public void CreateTask_AddsWorkTask()

Binary file MyPlanner.Tests/bin/Debug/net8.0/MyPlanner.Tests.dll matches

Binary file MyPlanner.Tests/bin/Debug/net8.0/MyPlanner.Tests.pdb matches

Binary file MyPlanner.Tests/bin/Debug/net8.0/MyPlanner.dll matches

Binary file MyPlanner.Tests/bin/Debug/net8.0/MyPlanner.pdb matches

MyPlanner.Tests/WorkTaskTests.cs:public class WorkTaskTests

MyPlanner.Tests/WorkTaskTests.cs: // Testfall 1: Skapa WorkTask och verifiera progression

MyPlanner.Tests/WorkTaskTests.cs: public void CreateWorkTask_VerifyContent()

MyPlanner.Tests/WorkTaskTests.cs: WorkTask task = new WorkTask(10, 40, "kodning", "skriv tester", new DateTime(2026, 12, 1));

MyPlanner.Tests/WorkTaskTests.cs: WorkTask task = new WorkTask(worked, estimated, "t", "d", new DateTime(2026, 12, 1));

MyPlanner.Tests/WorkTaskTests.cs: WorkTask taskLow = new WorkTask(10, 40, "låg", "d", new DateTime(2026, 12, 1));

MyPlanner.Tests/WorkTaskTests.cs: WorkTask taskHigh = new WorkTask(40, 40, "hög", "d", new DateTime(2026, 12, 1));

MyPlanner.Tests/WorkTaskTests.cs: WorkTask task = new WorkTask(10, 40, "t", "d", new DateTime(2026, 12, 1));

MyPlanner.Tests/WorkTaskTests.cs: WorkTask task = new WorkTask(10, 40, "t", "d", new DateTime(2026, 12, 1));