public void Verify_Get_ByKey_Should_ReturnTheCorrectObjectAlias() { // Arrange Mock <IDbSet <ObjectAlias> > mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); // Act var objectAliases = repository.Get("KING-STEPHEN"); // Assert Assert.Equal("/TEST/KING-STEPHEN", objectAliases.ApiDetailUrl); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock<IDbSet<ObjectAlias>> mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); // Act repository.Deactivate(objectAliases); // Assert Assert.Equal(false, objectAliases.Active); }
public void Verify_Deactivate_Should_SetTheActivePropertyToFalseOnTheEntity() { // Arrange Mock <IDbSet <ObjectAlias> > mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); // Act repository.Deactivate(objectAliases); // Assert Assert.Equal(false, objectAliases.Active); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock <IDbSet <ObjectAlias> > mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); // Act repository.Remove(objectAliases); // Assert mockSetObjectAliases.Verify(x => x.Remove((ObjectAlias)objectAliases), Times.Once); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock <IDbSet <ObjectAlias> > mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); objectAliases.ApiDetailUrl = "/TEST"; // Act repository.Update(objectAliases); // Assert mockContext.Verify(x => x.SetModified(It.IsAny <object>()), Times.Once); }
public void Verify_Get_ByID_Should_ReturnTheCorrectObjectAlias() { // Arrange Mock<IDbSet<ObjectAlias>> mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); // Act var objectAliases = repository.Get(1); // Assert Assert.Equal("/TEST/KING-STEPHEN", objectAliases.ApiDetailUrl); }
public void Verify_Update_Should_SetTheEntityStateToModified() { // Arrange Mock<IDbSet<ObjectAlias>> mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); objectAliases.ApiDetailUrl = "/TEST"; // Act repository.Update(objectAliases); // Assert mockContext.Verify(x => x.SetModified(It.IsAny<object>()), Times.Once); }
public void Verify_Remove_Should_RemoveTheEntityFromTheContext() { // Arrange Mock<IDbSet<ObjectAlias>> mockSetObjectAliases; var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(true, out mockSetObjectAliases); var repository = new ObjectAliasesRepository(mockContext.Object); var objectAliases = repository.Get(1); // Act repository.Remove(objectAliases); // Assert mockSetObjectAliases.Verify(x => x.Remove((ObjectAlias)objectAliases), Times.Once); }