示例#1
0
        public void CreateStructure_WhenHashSetOfComplex_ReturnsOneIndexPerElementInCorrectOrder()
        {
            Builder = StructureBuilder.Create(c => c.Register <TestItemWithHashSetOfComplex>());
            var item = new TestItemWithHashSetOfComplex
            {
                HashSetOfComplex = new HashSet <Value>
                {
                    new Value {
                        Is = 5
                    },
                    new Value {
                        Is = 6
                    },
                    new Value {
                        Is = 7
                    }
                }
            };

            var structure = Builder.CreateStructure(item);

            var indices = structure.Indexes.Where(i => i.Path.StartsWith("HashSetOfComplex[")).ToList();

            Assert.AreEqual(5, indices[0].Value);
            Assert.AreEqual(6, indices[1].Value);
            Assert.AreEqual(7, indices[2].Value);
        }
示例#2
0
        public void CreateStructure_WhenHashSetOfComplex_HasThreeNullItems_ReturnsNoIndex()
        {
            Builder = StructureBuilder.Create(c => c.Register <TestItemWithHashSetOfComplex>());
            var item = new TestItemWithHashSetOfComplex {
                HashSetOfComplex = new HashSet <Value> {
                    null, null, null
                }
            };

            var structure = Builder.CreateStructure(item);

            var actual = structure.Indexes.SingleOrDefault(si => si.Path.StartsWith("HashSetOfComplex.Is"));

            Assert.IsNull(actual);
        }
        public void CreateStructure_WhenHashSetOfComplex_HasThreeNullItems_ReturnsNoIndex()
        {
            var schema = StructureSchemaTestFactory.CreateRealFrom <TestItemWithHashSetOfComplex>();
            var item   = new TestItemWithHashSetOfComplex {
                HashSetOfComplex = new HashSet <Value> {
                    null, null, null
                }
            };

            var structure = Builder.CreateStructure(item, schema);

            var actual = structure.Indexes.SingleOrDefault(si => si.Path.StartsWith("HashSetOfComplex.Is"));

            Assert.IsNull(actual);
        }
        public void CreateStructure_WhenHashSetOfComplex_ReturnsOneIndexPerElementInCorrectOrder()
        {
            var schema = StructureSchemaTestFactory.CreateRealFrom <TestItemWithHashSetOfComplex>();
            var item   = new TestItemWithHashSetOfComplex {
                HashSetOfComplex = new HashSet <Value> {
                    new Value {
                        Is = 5
                    }, new Value {
                        Is = 6
                    }, new Value {
                        Is = 7
                    }
                }
            };

            var structure = Builder.CreateStructure(item, schema);

            var indices = structure.Indexes.Where(i => i.Path == "HashSetOfComplex.Is").ToList();

            Assert.AreEqual(5, indices[0].Value);
            Assert.AreEqual(6, indices[1].Value);
            Assert.AreEqual(7, indices[2].Value);
        }