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());
 }
Exemple #2
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);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
Exemple #5
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 Should_create_correct_events()
 {
     Assert.IsType <OfferCreated>(PublishedEvents.First());
     Assert.IsType <ProductDisplayed>(PublishedEvents[1]);
     Assert.IsType <OfferDisplayed>(PublishedEvents[2]);
     Assert.IsType <OfferPublishedToMerchant>(PublishedEvents[3]);
 }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
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);
        }
Exemple #11
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);
        }
        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);
        }
Exemple #13
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);
        }
        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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
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);
        }
Exemple #18
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);
        }
 public void Should_save_boardsize()
 {
     Assert.Equal(10, ((BoardCreated)PublishedEvents.First()).BoardSize);
 }
Exemple #20
0
 public void Should_create_correct_event()
 {
     Assert.IsType <InventoryItemCreated>(PublishedEvents.First());
 }
 public void Should_create_correct_event()
 {
     Assert.IsInstanceOf <ItemsCheckedInToInventory>(PublishedEvents.First());
 }
Exemple #22
0
 public void Should_create_correct_event()
 {
     Assert.IsType <GoalScored>(PublishedEvents.First());
 }
Exemple #23
0
 public void Should_save_correct_set_number()
 {
     Assert.Equal(1, ((GoalScored)PublishedEvents.First()).SetNumber);
 }
Exemple #24
0
 public void Should_save_scoring_team()
 {
     Assert.Equal(_teamA, ((GoalScored)PublishedEvents.First()).Scorer);
 }
Exemple #25
0
 public void Should_save_have_correct_number_of_items()
 {
     Assert.Equal(2, ((ItemsCheckedInToInventory)PublishedEvents.First()).Count);
 }
        public void Then_the_EventSourceId_should_be_set_to_the_ProjectId()
        {
            var evnt = (NewProjectCreated)PublishedEvents.First();

            AggregateRoot.EventSourceId.Should().Be(evnt.ProjectId);
        }
 public void Should_save_name()
 {
     Assert.AreEqual(2, ((ItemsCheckedInToInventory)PublishedEvents.First()).Count);
 }
 public void Then_one_event_NewProjectCreated_should_have_been_published()
 {
     PublishedEvents.Count().Should().Be(1);
     PublishedEvents.First().Should().BeOfType <NewProjectCreated>();
 }
Exemple #29
0
 public void Should_save_name()
 {
     Assert.Equal("myname", ((InventoryItemCreated)PublishedEvents.First()).Name);
 }
Exemple #30
0
 public void Should_save_hit_coordinate()
 {
     Assert.Equal(new BoardPoint(0, 2), ((ShipHit)PublishedEvents.First()).Target);
 }