public async Task GetRetrospectiveStatusCommand_ReturnsRetrospectiveInfo() { // Given var retro = new Retrospective { Title = "Yet another test", Participants = { new Participant { Name = "John", Color = Color.BlueViolet }, new Participant { Name = "Jane", Color = Color.Aqua }, }, HashedPassphrase = "abef", CurrentStage = RetrospectiveStage.Writing }; string retroId = retro.UrlId.StringId; this.Context.Retrospectives.Add(retro); await this.Context.SaveChangesAsync(CancellationToken.None); var query = new GetRetrospectiveStatusQuery(retroId); var handler = new GetRetrospectiveStatusQueryHandler(this.Context, new RetrospectiveStatusMapper(this.Context, this.Mapper)); // When var result = await handler.Handle(query, CancellationToken.None); // Then Assert.That(result.Lanes, Has.Count.EqualTo(3 /* Based on seed data */)); Assert.That(result.IsEditingNotesAllowed, Is.True); Assert.That(result.IsViewingOtherNotesAllowed, Is.False); Assert.That(result.RetroId, Is.EqualTo(retroId)); Assert.That(result.Title, Is.EqualTo(retro.Title)); }
public void GetRetrospectiveStatusCommand_ThrowsNotFoundException_WhenNotFound() { // Given const string retroId = "surely-not-found"; var query = new GetRetrospectiveStatusQuery(retroId); var handler = new GetRetrospectiveStatusQueryHandler(this.Context, Substitute.For <IRetrospectiveStatusMapper>()); // When TestDelegate action = () => handler.Handle(query, CancellationToken.None).GetAwaiter().GetResult(); // Then Assert.That(action, Throws.InstanceOf <NotFoundException>()); }