public void TestExecute() { MockOfITogglesUnitOfWork mockOfITogglesUnitOfWork = new MockOfITogglesUnitOfWork(); CreateToggleCommand createToggleCommand = new CreateToggleCommand(mockOfITogglesUnitOfWork.Object); Toggle toggle = this.CreateMockedToggle(); TestDelegate action = () => createToggleCommand.Execute(toggle); Assert.DoesNotThrow(action); mockOfITogglesUnitOfWork.Verify(m => m.SaveChanges(), Times.Once); }
public void TestExecute() { var mockOfITogglesUnitOfWork = new MockOfITogglesUnitOfWork(); IList <Toggle> mockedToggles = this.mockedTogglesCreator.CreateList(); var mockOfITogglesLoader = new MockOfITogglesLoader(mockedToggles); var deleteToggleCommand = new DeleteToggleCommand(mockOfITogglesUnitOfWork.Object, mockOfITogglesLoader.Object); Toggle toggleToDelete = mockedToggles.First(); TestDelegate action = () => deleteToggleCommand.Execute(toggleToDelete.Id); Assert.DoesNotThrow(action); mockOfITogglesUnitOfWork.MockOfITogglesRepository.Verify(m => m.Delete(toggleToDelete), Times.Once); mockOfITogglesUnitOfWork.Verify(m => m.SaveChanges(), Times.Once); }
public void TestExecute() { var mockOfITogglesUnitOfWork = new MockOfITogglesUnitOfWork(); IList <Toggle> mockedToggles = this.mockedTogglesCreator.CreateList(); var mockOfITogglesLoader = new MockOfITogglesLoader(mockedToggles); var updateToggleCommand = new UpdateToggleCommand(mockOfITogglesUnitOfWork.Object, mockOfITogglesLoader.Object); Toggle originalToggle = mockedToggles.First(); Toggle updatedToggle = this.CreateMockedUpdatedToggle(originalToggle); TestDelegate action = () => updateToggleCommand.Execute(updatedToggle); Assert.DoesNotThrow(action); mockOfITogglesUnitOfWork.MockOfITogglesRepository.Verify(m => m.Update(updatedToggle), Times.Once); mockOfITogglesUnitOfWork.Verify(m => m.SaveChanges(), Times.Once); }