public void DeleteConsultants_GetDeletedConsultantSHouldThrowException() { using (var context = GetContextWithData()) { var service = new SQLConsultantRepository(context); var seppe = service.GetConsultant(4); service.DeleteConsultant(seppe); Assert.Throws <ArgumentOutOfRangeException>(() => service.GetConsultant(4)); } }
public void UpdateConsultant_ShouldUpdateChangedProperties() { using (var context = GetContextWithData()) { var service = new SQLConsultantRepository(context); var koen = service.GetConsultant(2); koen.EmailAddress = "NewEmailAddress"; service.UpdateConsultant(koen); Assert.True(service.GetConsultant(2).EmailAddress == "NewEmailAddress"); } }
public void GetConsultant_ThrowsExceptionWhenFakeID() { using (var context = GetContextWithData()) { var service = new SQLConsultantRepository(context); Assert.Throws <ArgumentOutOfRangeException>(() => service.GetConsultant(10)); } }
public void GetConsultant_ShouldReturnSpecificResource() { using (var context = GetContextWithData()) { var service = new SQLConsultantRepository(context); Assert.True(service.GetConsultant(2).FirstName == "Koen"); } }
public void AddConsultant_ShouldCreateAResource() { using (var context = GetContextWithData()) { var service = new SQLConsultantRepository(context); var carla = new Consultant("Carla", "Nelissen", "Network Engineer", "Limburg", "*****@*****.**", "0478965432", new DateTime(1980, 01, 01)); service.AddConsultant(carla); Assert.True(service.GetConsultant(6).FirstName == "Carla"); Assert.True(service.GetConsultant(6).LastName == "Nelissen"); Assert.True(service.GetConsultant(6).Description == "Network Engineer"); Assert.True(service.GetConsultant(6).Place == "Limburg"); Assert.True(service.GetConsultant(6).EmailAddress == "*****@*****.**"); Assert.True(service.GetConsultant(6).PhoneNumber == "0478965432"); Assert.True(service.GetConsultant(6).DateOfBirth == new DateTime(1980, 01, 01)); } }