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); }
public void GetById_CorrectDataGot_ActualEqualExpectedData() { var expectedUserType = new UserType { ID = 1, Description = "User" }; UserType actualUserType; using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { actualUserType = userTypeRepo.GetById(expectedUserType.ID); } AssertUserTypesEqual(expectedUserType, actualUserType); }
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); }
public void Update_WasUserTypeUpdated_ActualEqualsExpectedData() { var expectedUserType = new UserType { ID = 1, Description = "UpdatedUserType" }; UserType actualUserType; using (var userTypeRepo = new UserTypeRepository(new brothershipEntities(ConnectionStrings.TEST_CONNECTION_STRING_NAME))) { userTypeRepo.Update(expectedUserType); actualUserType = userTypeRepo.GetById(expectedUserType.ID); } AssertUserTypesEqual(expectedUserType, actualUserType); }