public void CreateLibraryCommandExecute_WhenSuccess_ReturnsCommandResultWithSuccess() { var message = new CreateBookMessage { Title = "Books" }; var command = GetCommandWithSession(message); var result = command.Execute(); Assert.That(result.IsSuccess(), Is.True); }
public void CreateLibraryCommandExecute_Always_StoreAndSaveChanges() { var message = new CreateBookMessage { Title = "Books" }; var command = GetCommandWithSession(message); command.Execute(); sessionMock.Verify(s => s.Store(It.Is<Book>(l => l.Title == "Books"))); sessionMock.Verify(s => s.SaveChanges()); }
public void CreateLibraryCommandExecute_Always_SetsCurrentUserAsCreator() { var message = new CreateBookMessage { Title = "Books" }; var command = GetCommandWithSession(message); var currentUser = new User(); command.FakeCurrentUser = currentUser; command.Execute(); sessionMock.Verify(s => s.Store(It.Is<Book>(l => l.Creator == currentUser))); }