コード例 #1
0
        public void AddOne_Will_Return_The_Builder_It_Just_Added_To_Builders()
        {
            var parentBuilder = new BuilderForTesting <ExampleClass>();
            var t             = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder);

            var res = t.AddOne();

            t.Builders.Should().OnlyContain(x => x == res);
        }
コード例 #2
0
        public void AddOne_Will_Add_Item_Builder_To_Builders()
        {
            var parentBuilder = new BuilderForTesting <ExampleClass>();
            var t             = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder);

            t.AddOne();

            t.Builders.Count.Should().Be(1, "only one builder should be added");
            t.Builders.Should().ContainItemsAssignableTo <ExampleChildClassBuilder>();
        }
コード例 #3
0
        public void AddOne_With_Instance_Will_Add_Item_Builder_With_That_Instance_To_Builders()
        {
            var parentBuilder = new BuilderForTesting <ExampleClass>();
            var t             = new CollectionBuilder <ExampleChildClass, ExampleChildClassBuilder>(parentBuilder);
            var c             = new ExampleChildClass();

            t.AddOne(c);

            t.Builders.Count.Should().Be(1);
            t.CreateAll().Should().OnlyContain(x => x == c);
        }