public void PrepareCorrectIdClientTest() { // arrange int idClient = Convert.ToInt32(TestContext.DataRow["idClient"]); const string firstname = "Jan"; const string surname = "Kowalski"; const string telephone = "2132123133"; const string pesel = "2142421412421"; int maxIdValue = Convert.ToInt32(TestContext.DataRow["maxIdValue"]); Client client = new Client(idClient, firstname, surname, telephone, pesel); ClientManager clientManager = new ClientManager(); IChecker checker = new ComputerService.Fakes.StubIChecker() { CheckClientIdExistanceIClientInt32 = (iclient, id) => { if (client.IdClient <= maxIdValue) { return(true); } return(false); } }; int expectedId = Convert.ToInt32(TestContext.DataRow["expectedId"]); clientManager.PrepareCorrectIdClient(client, checker); Assert.AreEqual(expectedId, client.IdClient); }
public void PrepareCorrectIdTechnicianTest() { // arrange const int idTechnician = 125; const string firstname = "Jan"; const string surname = "Kowalski"; const int salary = 2000; const int maxIdValue = 150; Technician technician = new Technician(idTechnician, firstname, surname, salary); TechnicianManager technicianManager = new TechnicianManager(); IChecker checker = new ComputerService.Fakes.StubIChecker() { CheckTechnicianIdExistanceITechnicianInt32 = (itechnician, id) => { if (technician.IdTechnician <= maxIdValue) { return(true); } return(false); } }; const int expectedId = 151; // act technicianManager.PrepareCorrectIdTechnician(technician, checker); // assert Assert.AreEqual(expectedId, technician.IdTechnician); }