private static KanbanBoardController CreateController() { var authService = ScenarioContext.Current.Get<IAuthenticationService>(); var repository = ScenarioContext.Current.Get<IKanbanBoardRepository>(); var readService = new KanbanBoardReadService(repository); var commandService = new KanbanBoardCommandService(repository); return new KanbanBoardController(readService, authService, commandService); }
public void should_add_a_KanbanBoard_when_called_with_correct_AddKanbanBoardCommand() { // Arrange var cmd = new AddKanbanBoardCommand { Title = "Test tile", User = "******", Description = "A long description that contains information", BoardImage = @"C:\Path\", Tags = "Tag1, Tag2, Tag3" }; var repository = Substitute.For<IKanbanBoardRepository>(); var commandService = new KanbanBoardCommandService(repository); // Act commandService.AddKanbanBoard(cmd); // Assert repository.Received().Add(Arg.Is<KanbanBoard>(x => x.Title == cmd.Title)); repository.Received().Add(Arg.Is<KanbanBoard>(x => x.User == cmd.User)); repository.Received().Add(Arg.Is<KanbanBoard>(x => x.Tags == cmd.Tags)); repository.Received().Add(Arg.Is<KanbanBoard>(x => x.Description == cmd.Description)); }