public async Task Handle_GivenValidRequest_ShouldSaveRetrospectiveWithHash() { // Given var passphraseService = Substitute.For <IPassphraseService>(); var systemClock = Substitute.For <ISystemClock>(); var urlGenerator = Substitute.For <IUrlGenerator>(); var handler = new CreateRetrospectiveCommandHandler(this.Context, passphraseService, systemClock, urlGenerator, new NullLogger <CreateRetrospectiveCommandHandler>()); passphraseService.CreateHashedPassphrase("anything").Returns("myhash"); passphraseService.CreateHashedPassphrase("facilitator password").Returns("facilitatorhash"); urlGenerator.GenerateUrlToRetrospectiveLobby(Arg.Any <RetroIdentifier>()).Returns(new Uri("https://example.com/retro/1")); systemClock.CurrentTimeOffset.Returns(DateTimeOffset.UnixEpoch); var request = new CreateRetrospectiveCommand { Passphrase = "anything", FacilitatorPassphrase = "facilitator password", Title = "Hello" }; // When CreateRetrospectiveCommandResponse result = await handler.Handle(request, CancellationToken.None); // Then Assert.That(result.Identifier.StringId, Is.Not.Null); Assert.That(this.Context.Retrospectives.Any(), Is.True); Assert.That(this.Context.Retrospectives.First().FacilitatorHashedPassphrase, Is.EqualTo("facilitatorhash")); Assert.That(this.Context.Retrospectives.First().CreationTimestamp, Is.EqualTo(DateTimeOffset.UnixEpoch)); }
public static async Task <string> CreateRetrospective(this IServiceScope scope, string facilitatorPassphrase) { scope.SetNoAuthenticationInfo(); var command = new CreateRetrospectiveCommand { Title = TestContext.CurrentContext.Test.FullName, FacilitatorPassphrase = facilitatorPassphrase }; CreateRetrospectiveCommandResponse result = await scope.Send(command); return(result.Identifier.StringId); }
private async Task <string> CreateRetrospective(string facilitatorPassword, string password) { var command = new CreateRetrospectiveCommand { Title = TestContext.CurrentContext.Test.FullName, FacilitatorPassphrase = facilitatorPassword, Passphrase = password }; this.ServiceScope.SetNoAuthenticationInfo(); CreateRetrospectiveCommandResponse result = await this.ServiceScope.Send(command); return(result.Identifier.StringId); }