コード例 #1
0
        public void Should_be_able_to_reconfigure_using_generics_type()
        {
            var item = new MyType
            {
                MyInt    = 42,
                MyString = "Foo"
            };

            var structure = UnitUnderTest.CreateStructure(item);

            structure.Name.Should().Be(nameof(MyType));
            structure.Indexes.Should().HaveCount(2);
            structure.Indexes.Should()
            .Contain(i => i.Name == nameof(item.MyInt))
            .Which.Value.Should().Be(item.MyInt);
            structure.Indexes.Should()
            .Contain(i => i.Name == nameof(item.MyString))
            .Which.Value.Should().Be(item.MyString);

            UnitUnderTest.Configure <MyType>(cfg => cfg.Members("MyInt").UsingIndexMode(IndexMode.Inclusive));

            structure = UnitUnderTest.CreateStructure(item);
            structure.Name.Should().Be(nameof(MyType));
            structure.Indexes.Should().HaveCount(1);
            structure.Indexes.Should()
            .Contain(i => i.Name == nameof(item.MyInt))
            .Which.Value.Should().Be(item.MyInt);
        }