C# OOP Exam - 12 Apr 2020. Unit test
Здравейте,
Дава ми 80/100, а не се сещам коя проверка изпускам. Ако може идеи кои два теста не правя: https://pastebin.com/edr3ubqH
Благодаря предварително
Здравейте,
Дава ми 80/100, а не се сещам коя проверка изпускам. Ако може идеи кои два теста не правя: https://pastebin.com/edr3ubqH
Благодаря предварително
Best thing is to watch
Video 10 August 2020 - Stoyan Shopov for the given exam and compare your code step-by-step until you find all problems.
One Test case didn't work, giving 90/100 from judge:
[Test]
[TestCase(10, 15)]
[TestCase(25, 50)]
public void WorkWhenTheBatteryIsLow(int battery, int batteryUsage)
{
var newrobotmanager = new RobotManager(10);
var db = new Robot("Robby", battery);
Assert.Throws<InvalidOperationException>(() =>
{
//newrobotmanager.Work(null, "Charge", batteryUsage);
newrobotmanager.Work("Robby", "Charge", batteryUsage);
// you need to use the robot's name,
//otherwise you will fall in the wrong Exception case for invalid Robot
});
}
Here comes the tricky part when you have 90/100, it's most certainly one of the tests that check Add/Remove/Charge/Work. The problem is not the cases themselves, they may be written correctly, but the data that you are using is not valid for judge. See discussion on Проблем с Unit Testing - C# OOP Exam 16 August 2020
where iGeorg1ev has thankfully found the problem.
Best,