コード例 #1
0
        public void AggregateChild_GetParent_Succeeds()
        {
            // arrange
            var sut = new ChildModel();

            // act
            sut.SetParent(new RootModel());

            // assert
            sut.GetParent().Should().NotBeNull();
        }
コード例 #2
0
        public void AggregateChild_AddEvent_Succeeds()
        {
            // arrange
            var root = new RootModel();
            var sut  = new ChildModel();

            sut.SetParent(root);

            // act
            sut.AddEvent(new SomeEvent(root));

            // assert
            sut.Parent.Should().NotBeNull();
            sut.Parent?.EventQueue.Should().NotBeEmpty();
        }
コード例 #3
0
        public void AggregateChild_AddEvent_From_GrandChild_Adds_To_Top_Succeeds()
        {
            // arrange
            var root  = new RootModel();
            var child = new ChildModel();

            child.SetParent(root);
            var sut = new GrandChildModel();

            sut.SetParent(child);

            // act
            sut.AddEvent(new SomeEvent(child));

            // assert
            sut.Parent.Should().NotBeNull();
            root.EventQueue.Should().NotBeEmpty();
        }