Ejemplo n.º 1
0
        public void And_the_event_should_contain_the_correct_details()
        {
            var theEvent = PublishedEvents.First().As <NewProjectCreated>();

            theEvent.ProjectId.Should().Be(ExecutedCommand.ProjectId);
            theEvent.Name.Should().Be(ExecutedCommand.Name);
        }
Ejemplo n.º 2
0
 public void Then_the_published_event_will_contain_the_new_address_of_the_client()
 {
     PublishedEvents.Last <ClientMovedEvent>().Street.WillBe("Welhavens gate");
     PublishedEvents.Last <ClientMovedEvent>().StreetNumber.WillBe("49b");
     PublishedEvents.Last <ClientMovedEvent>().PostalCode.WillBe("5006");
     PublishedEvents.Last <ClientMovedEvent>().City.WillBe("Bergen");
 }
 public void Should_create_correct_events()
 {
     Assert.IsType <OfferCreated>(PublishedEvents.First());
     Assert.IsType <ProductDisplayed>(PublishedEvents[1]);
     Assert.IsType <OfferDisplayed>(PublishedEvents[2]);
     Assert.IsType <OfferPublishedToMerchant>(PublishedEvents[3]);
 }
Ejemplo n.º 4
0
        private void ThenASystemCreatedEventIsPublishedOnEvelyn()
        {
            var @event = PublishedEvents.First(e => e.GetType() == typeof(EvelynEvent.SystemCreated)) as EvelynEvent.SystemCreated;

            @event.UserId.Should().Be(Constants.SystemUser);
            @event.Id.Should().Be(Constants.EvelynSystem);
        }
        public void the_person_should_have_moved_house()
        {
            Assert.That(this.PublishedEvents.Count <IEvent>() == 1);

            Console.WriteLine("count:\t{0}\r\nthing:\t{1}", PublishedEvents.Count <IEvent>(), PublishedEvents);
            Console.WriteLine("lastevent:\t{0}", PublishedEvents.Last <IEvent>());
        }
Ejemplo n.º 6
0
        private void ThenAProjectAddedToAccountEventIsPublished()
        {
            var @event = PublishedEvents.First(e => e.GetType() == typeof(AccountEvent.ProjectCreated)) as AccountEvent.ProjectCreated;

            @event.UserId.Should().Be(UserId);
            @event.ProjectId.Should().Be(_projectId);
        }
Ejemplo n.º 7
0
 public void Then_the_published_event_will_contain_the_address_of_the_client()
 {
     PublishedEvents.Last <CustomerCreatedEvent>().Street.Should().Be.EqualTo("Ringstraße");
     PublishedEvents.Last <CustomerCreatedEvent>().StreetNumber.Should().Be.EqualTo("1");
     PublishedEvents.Last <CustomerCreatedEvent>().PostalCode.Should().Be.EqualTo("1010");
     PublishedEvents.Last <CustomerCreatedEvent>().City.Should().Be.EqualTo("Wien");
 }
 public void Then_it_will_generate_an_deposite_event_with_the_expected_ammount()
 {
     PublishedEvents.Last <MoneyTransferReceivedEvent>().Amount.WillBe(5.0M);
     PublishedEvents.Last <MoneyTransferReceivedEvent>().Balance.WillBe(25.0M);
     PublishedEvents.Last <MoneyTransferReceivedEvent>().TargetAccount.WillBe("1234567890");
     PublishedEvents.Last <MoneyTransferReceivedEvent>().SourceAccount.WillBe("0987654321");
 }
 public void Then_the_published_event_will_contain_the_expected_details_of_the_closed_account()
 {
     PublishedEvents.Last <ClosedAccountCreatedEvent>().OriginalAccountId.WillBe(_accountId);
     PublishedEvents.Last <ClosedAccountCreatedEvent>().ClientId.WillBe(_clientId);
     PublishedEvents.Last <ClosedAccountCreatedEvent>().AccountName.WillBe("Closed Account");
     PublishedEvents.Last <ClosedAccountCreatedEvent>().AccountNumber.WillBe("1234567890");
 }
 public void Should_create_correct_events()
 {
     Assert.IsType <OfferStockSet>(PublishedEvents.First());
     Assert.IsType <ProductHidden>(PublishedEvents[1]);
     Assert.IsType <OfferHidden>(PublishedEvents[2]);
     Assert.IsType <OfferUnpublishedFromMerchant>(PublishedEvents.Last());
 }
Ejemplo n.º 11
0
        public void Should_verify_last_event_properties()
        {
            var childDisabledEvent = PublishedEvents.Last().As <ChildDisabledEvent>();

            childDisabledEvent.AggregateId.Should().Be(_event2.AggregateId);
            childDisabledEvent.EntityId.Should().Be(_event2.EntityId);
        }
Ejemplo n.º 12
0
        private void ThenAnAccountRegisteredEventIsPublishedOnTheAccount()
        {
            var @event = PublishedEvents.First(e => e.GetType() == typeof(AccountEvent.AccountRegistered)) as AccountEvent.AccountRegistered;

            @event.UserId.Should().Be(UserId);
            @event.Id.Should().Be(_accountId);
        }
Ejemplo n.º 13
0
        private void ThenAnEnvironmentDeletedEventIsPublished()
        {
            var ev = (EnvironmentDeleted)PublishedEvents.First(e => e.GetType() == typeof(EnvironmentDeleted));

            ev.UserId.Should().Be(UserId);
            ev.Key.Should().Be(_environmentToDeleteKey);
            ev.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
        }
Ejemplo n.º 14
0
 public void Publish <TEvent>(IEnumerable <TEvent> events)
     where TEvent : IEvent <ISingleSignOnToken>
 {
     foreach (TEvent @event in events)
     {
         PublishedEvents.Add(@event);
     }
 }
Ejemplo n.º 15
0
        private void ThenAnEnvironmentAddedEventIsPublished()
        {
            var @event = (EnvironmentAdded)PublishedEvents.First(ev => ev is EnvironmentAdded);

            @event.UserId.Should().Be(UserId);
            @event.Key.Should().Be(_newEnvironmentKey);
            @event.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
        }
Ejemplo n.º 16
0
 public void Then_the_published_event_will_contain_the_expected_ledgers_of_the_closed_account()
 {
     PublishedEvents.Last <ClosedAccountCreatedEvent>().Ledgers.Count().WillBe(4);
     PublishedEvents.Last <ClosedAccountCreatedEvent>().Ledgers[0].Key.WillBe("CreditMutation");
     PublishedEvents.Last <ClosedAccountCreatedEvent>().Ledgers[1].Key.WillBe("DebitMutation");
     PublishedEvents.Last <ClosedAccountCreatedEvent>().Ledgers[2].Key.WillBe("CreditTransfer");
     PublishedEvents.Last <ClosedAccountCreatedEvent>().Ledgers[3].Key.WillBe("DebitTransfer");
 }
Ejemplo n.º 17
0
        private void ThenAToggleAddedEventIsPublished()
        {
            var ev = (ToggleAdded)PublishedEvents.First(e => e.GetType() == typeof(ToggleAdded));

            ev.UserId.Should().Be(UserId);
            ev.Name.Should().Be(_newToggleName);
            ev.Key.Should().Be(_newToggleKey);
        }
Ejemplo n.º 18
0
 protected override void Finally()
 {
     base.Finally();
     TheEvent = PublishedEvents
                .Select(e => e.Payload)
                .OfType <TEvent>()
                .FirstOrDefault();
 }
Ejemplo n.º 19
0
        private void ThenAnAccountRegisteredEventIsPublishedOnEvelyn()
        {
            var @event = PublishedEvents.First(e => e.GetType() == typeof(EvelynEvent.AccountRegistered)) as EvelynEvent.AccountRegistered;

            @event.UserId.Should().Be(UserId);
            @event.Id.Should().Be(Constants.EvelynSystem);
            @event.AccountId.Should().Be(_accountId);
        }
Ejemplo n.º 20
0
        private void ThenAnEnvironmentStateAddedEventIsPublished()
        {
            var @event = (EnvironmentStateAdded)PublishedEvents.First(ev => ev is EnvironmentStateAdded);

            @event.UserId.Should().Be(UserId);
            @event.EnvironmentKey.Should().Be(_newEnvironmentKey);
            @event.ToggleStates.ToList().Exists(ts => ts.Key == _toggleKey && ts.Value == default(bool).ToString());
            @event.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
        }
Ejemplo n.º 21
0
        private void ThenAProjectCreatedEventIsPublishedForAProject()
        {
            var @event = PublishedEvents.First(e => e.GetType() == typeof(ProjectEvent.ProjectCreated)) as ProjectEvent.ProjectCreated;

            @event.UserId.Should().Be(UserId);
            @event.AccountId.Should().Be(_accountId);
            @event.Id.Should().Be(_projectId);
            @event.Name.Should().Be(_projectName);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Create service model from api model
 /// </summary>
 public PublishedDataSetSourceModel ToServiceModel()
 {
     return(new PublishedDataSetSourceModel {
         Connection = Connection?.ToServiceModel(),
         PublishedEvents = PublishedEvents?.ToServiceModel(),
         PublishedVariables = PublishedVariables?.ToServiceModel(),
         SubscriptionSettings = SubscriptionSettings?.ToServiceModel()
     });
 }
Ejemplo n.º 23
0
        public void Then_the_ProjectRenamed_event_been_published()
        {
            PublishedEvents.Count().Should().Be(1);

            var evnt = (ProjectRenamed)PublishedEvents.First();

            evnt.EventSourceId.Should().Be(TheId);
            evnt.NewName.Should().Be(NewName);
        }
Ejemplo n.º 24
0
        public void Then_project_id_and_name_should_be_published_as_given_at_construct()
        {
            var evnt = PublishedEvents.First().As <NewProjectCreated>();

            evnt.ProjectId.Should().Be(TheId);

            evnt.Name.Should().Be(TheName);

            evnt.ShortCode.Should().NotBe(TheShortCode);
        }
Ejemplo n.º 25
0
        private void ThenThePublishedEventIsToggledValueChanged()
        {
            var ev = (ToggleStateChanged)PublishedEvents.First();

            ev.Id.Should().Be(_projectId);
            ev.EnvironmentKey.Should().Be(_environmentKey);
            ev.ToggleKey.Should().Be(_toggleKey);
            ev.Value.Should().Be(_newToggleValue);
            ev.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
            ev.UserId.Should().Be(UserId);
        }
Ejemplo n.º 26
0
        private void ThenAnEnvironmentStateDeletedEventsIsPublishedForEnvironment(string environmentKey)
        {
            var ev = (EnvironmentStateDeleted)PublishedEvents
                     .First(e =>
                            e.GetType() == typeof(EnvironmentStateDeleted) &&
                            ((EnvironmentStateDeleted)e).EnvironmentKey == environmentKey);

            ev.EnvironmentKey.Should().Be(_environmentToDeleteKey);
            ev.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
            ev.UserId.Should().Be(UserId);
        }
Ejemplo n.º 27
0
        private void ThenAnToggleStateAddedEventsIsPublishedForEnvironment(string environmentKey)
        {
            var ev = (ToggleStateAdded)PublishedEvents
                     .First(e =>
                            e.GetType() == typeof(ToggleStateAdded) &&
                            ((ToggleStateAdded)e).EnvironmentKey == environmentKey);

            ev.ToggleKey.Should().Be(_newToggleKey);
            ev.Value.Should().Be(NewAggregate.Toggles.First(t => t.Key == _newToggleKey).DefaultValue);
            ev.OccurredAt.Should().BeAfter(TimeBeforeHandling).And.BeBefore(TimeAfterHandling);
            ev.UserId.Should().Be(UserId);
        }
Ejemplo n.º 28
0
        public void Then_published_events_count_should_be_one()
        {
            PublishedEvents.Should().HaveCount(2);
            PublishedEvents.First().Should().BeOfType <MediaPlanCreated>();

            var theEvent = PublishedEvents.First().As <MediaPlanCreated>();

            theEvent.PlanNo.Should().Be(1);

            var budgetSet = PublishedEvents.ElementAt(1).As <BudgetForMediaPlanSet>();

            budgetSet.Budget.Should().Be(10000);
        }
Ejemplo n.º 29
0
 public void Event_should_be_TestEvent()
 {
     PublishedEvents.ShouldAllBeEquivalentTo(new DomainEvent[]
     {
         new TestAggregateCreated(1.MakeGuid())
         {
             Version = 1
         },
         new TestMethodCalled(1.MakeGuid())
         {
             Version = 2
         }
     }, options => options.Excluding(e => e.TimeStamp)
                                             .Excluding(e => e.SessionInfo));
 }
Ejemplo n.º 30
0
        public void Event_should_be_TestEvent()
        {
            var info = new SessionInfo();

            PublishedEvents.ShouldAllBeEquivalentTo(new DomainEvent[]
            {
                new TestAggregateCreated(Guid.NewGuid())
                {
                    Id = GetGuid(1), SessionInfo = info, Version = 1
                },
                new TestOtherAggregateCreated(Guid.NewGuid())
                {
                    Id = GetGuid(2), SessionInfo = info, Version = 1
                }
            }, options => options.Excluding(e => e.TimeStamp));
        }