public void DetailsReturnNotFound_WhenPathIdNotFound() { var query = new GetModuleDetailsQuery() { PathId = 99999, Id = 1 }; FluentActions.Invoking(() => SendAsync(query)).Should().ThrowAsync <NotFoundException>(); }
public async Task GetDetails_ShouldReturnModuleDetails() { var path = await AddAsync( new Path { Title = "Some Another Path", Key = "some-path", Description = "Path Description" }); var module = await SendAsync(new CreateModule { Title = "New Other Module", Key = "module-key", Description = "New Other Module Description", Necessity = Necessity.MustKnow, Tags = new List <string> { "Tag1", "Tag2", "Tag3" } }); await AddAsync(new Theme { Title = "New Theme1", ModuleId = module.Id, Description = "New Theme1 Description", Necessity = Necessity.MustKnow, Complexity = Complexity.Beginner, Tags = new List <string> { "Theme1", "ThemeTag2", "Tag3" }, Order = 1 }); await AddAsync(new Theme { Title = "New Theme2", ModuleId = module.Id, Description = "New Theme2 Description", Necessity = Necessity.MustKnow, Complexity = Complexity.Beginner, Tags = new List <string> { "Theme2", "ThemeTag2", "Tag3" }, Order = 2 }); var query = new GetModuleDetailsQuery() { PathId = path.Id, Id = module.Id }; var result = await SendAsync(query); result.Title.Should().NotBeEmpty(); result.Description.Should().NotBeEmpty(); result.Themes.Should().HaveCount(2); result.Tags.Should().HaveCount(3); }
public void GetDetails_ShouldThrow_WhenCanceled() { var cts = new CancellationTokenSource(); cts.Cancel(); var query = new GetModuleDetailsQuery() { PathId = 1, Id = 1 }; FluentActions.Invoking(() => SendAsync(query, cts.Token)).Should().ThrowAsync <TaskCanceledException>(); }