public void DeleteById_WasDeleted_actualDataIsNull() { var typeIdToDelete = AddandGetTestUserType().ID; UserType actualUserType; using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userTypeRepo.Delete(typeIdToDelete); userTypeRepo.SaveChanges(); actualUserType = userTypeRepo.GetById(typeIdToDelete); } Assert.IsNull(actualUserType); }
private UserType AddandGetTestUserType() { var userTypeType = new UserType { Description = "TestUserType" }; using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userTypeRepo.Add(userTypeType); userTypeRepo.SaveChanges(); } return(userTypeType); }
public void Add_WasUserTypeAdded_ActualEqualsExpectedData() { var expectedUserType = new UserType { Description = "NewTestType" }; UserType actualUserType; using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userTypeRepo.Add(expectedUserType); userTypeRepo.SaveChanges(); actualUserType = userTypeRepo.GetById(expectedUserType.ID); } AssertUserTypesEqual(expectedUserType, actualUserType); }