public void Retrieve_WithScenarioDataInDatabase_ExpectEnityIsNull( int id) { // Arrange var classUnderTest = new IndividualDal(ConnectionString); // Act var actual = classUnderTest.Retrieve(id); // Assert Assert.Null(actual); }
public void Retrieve_WithScenarioDataInDatabase_ExpectProperLastName( int id, string expectedLastName) { // Arrange var classUnderTest = new IndividualDal(ConnectionString); // Act var actual = classUnderTest.Retrieve(id); // Assert Assert.NotNull(actual); Assert.AreEqual(expectedLastName, actual.LastName); }
public void Update_WithScenarioDataInDatabase_ExpectLastNameIsChanged( int id, string expectedLastname) { // Arrange var classUnderTest = new IndividualDal(ConnectionString); var entity = classUnderTest.Retrieve(id); Assert.NotNull(entity); entity.LastName = expectedLastname; // Act classUnderTest.Update(entity); // Assert var result = classUnderTest.Retrieve(id); Assert.NotNull(result); Assert.AreEqual(expectedLastname, result.LastName); }
public void Update_WithScenarioDataInDatabaseAndLastNameIsInvalid_ExpectSqlException( int id) { // Arrange var classUnderTest = new IndividualDal(ConnectionString); var entity = classUnderTest.Retrieve(id); Assert.NotNull(entity); entity.LastName = null; // Act classUnderTest.Update(entity); // Assert Assert.Fail("Expected an exception"); }
public void Delete_WithScenarioDataInDatabase_ExpectEntityIsRemoved( int id) { // Arrange var classUnderTest = new IndividualDal(ConnectionString); var entity = classUnderTest.Retrieve(id); Assert.NotNull(entity); // Act classUnderTest.Delete(entity); // Assert var result = classUnderTest.Retrieve(id); Assert.IsNull(result); }