Beispiel #1
0
        public async Task CheckThat_SessionWithNoSchedule_IsRequested()
        {
            var person         = PersonId.New();
            var start          = default(DateTimeOffset?);
            var end            = default(DateTimeOffset?);
            var repository     = new FakeSessionStore();
            var sessionQueries = new FakePersonProjectionStore();

            sessionQueries.AddPerson(person, "John Doe");
            var command = new RequestSession(new[] { person }, "super session", "Ca va etre chouette", new[] { "super", "chouette" }, start, end);
            var sut     = new RequestSessionCommandHandler(repository, sessionQueries);

            var(result, events) = await sut.ExecuteAsync(command);

            Check.That(result).InheritsFrom <SuccessCommandResult>();
            Check.That(events).CountIs(1);
            Check.That(events[0]).IsInstanceOf <SessionRequested>();
            var sessionRequestedEvent = (SessionRequested)events[0];
            var session = repository.Sessions[sessionRequestedEvent.Id];

            Check.That(session.Speakers).IsEquivalentTo(command.Speakers);
            Check.That(session.Title).IsEqualTo(command.Title);
            Check.That(session.Description).IsEqualTo(command.Description);
            Check.That(session.Tags).IsEquivalentTo(command.Tags);
            Check.That(session.Schedule).IsNull();
            Check.That(session.Status).IsEqualTo(SessionStatus.Requested);
        }
Beispiel #2
0
        protected virtual void ConfigureTestServices(IServiceCollection services)
        {
            var personProjectionStore = new FakePersonProjectionStore();

            personProjectionStore.AddPerson(TestAuthenticationHandler.UserPersonId, "John TheUser");
            services.AddSingleton(personProjectionStore);
            services.AddTransient <IPersonProjectionStore>(p => p.GetRequiredService <FakePersonProjectionStore>());

            services.AddAuthentication(TestAuthenticationHandler.TestScheme)
            .AddScheme <AuthenticationSchemeOptions, TestAuthenticationHandler>(TestAuthenticationHandler.TestScheme, o => { });
        }