public void Verify_Get_ByKey_Should_ReturnTheCorrectGender() { // Arrange Mock <IDbSet <Gender> > mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); // Act var genders = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", genders.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<Gender>> mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); // Act repository.Deactivate(genders); // Assert Assert.Equal(false, genders.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <Gender> > mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); // Act repository.Deactivate(genders); // Assert Assert.Equal(false, genders.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <Gender> > mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); // Act repository.Remove(genders); // Assert mockSetGenders.Verify(x => x.Remove((Gender)genders), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <Gender> > mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); genders.ApiDetailUrl = "/TEST"; // Act repository.Update(genders); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectGender() { // Arrange Mock<IDbSet<Gender>> mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); // Act var genders = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", genders.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<Gender>> mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); genders.ApiDetailUrl = "/TEST"; // Act repository.Update(genders); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<Gender>> mockSetGenders; var mockContext = GendersMockingSetup.DoMockingSetupForContext(true, out mockSetGenders); var repository = new GendersRepository(mockContext.Object); var genders = repository.Get(1); // Act repository.Remove(genders); // Assert mockSetGenders.Verify(x => x.Remove((Gender)genders), Times.Once); }