public void GetIndexes_WhenItemWithComplexEnumerable_ReturnsIndexWithDataTypeOfStringElement()
        {
            var item = new WithComplexArray { Items = new[] { new Complex {Name = "Foo", Value = 42} } };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom<WithComplexArray>();

            var factory = new StructureIndexesFactory();
            var indexes = factory.CreateIndexes(schemaStub, item, _structureIdGenerator.Invoke()).ToList();

            Assert.AreEqual(DataTypeCode.String, indexes.Single(i => i.Path == "Items.Name").DataTypeCode);
            Assert.AreEqual(DataTypeCode.IntegerNumber, indexes.Single(i => i.Path == "Items.Value").DataTypeCode);
        }
Exemplo n.º 2
0
        public void GetIndexes_WhenItemWithComplexEnumerable_ReturnsIndexWithDataTypeOfStringElement()
        {
            var item = new WithComplexArray {
                Items = new[] { new Complex {
                                    Name = "Foo", Value = 42
                                } }
            };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom <WithComplexArray>();

            var factory = new StructureIndexesFactory();
            var indexes = factory.CreateIndexes(schemaStub, item, _structureIdGenerator.Invoke()).ToList();

            Assert.AreEqual(DataTypeCode.String, indexes.Single(i => i.Path == "Items.Name").DataTypeCode);
            Assert.AreEqual(DataTypeCode.IntegerNumber, indexes.Single(i => i.Path == "Items.Value").DataTypeCode);
        }
Exemplo n.º 3
0
        public void GetIndexes_WhenArrayOfComplexWithChildBeingNull_ReturnesNoIndexes()
        {
            var item = new WithComplexArray
            {
                Items = new[] { new Complex {
                                    Name = null, Value = 42
                                } }
            };

            var schemaStub = StructureSchemaTestFactory.CreateRealFrom <WithComplexArray>();

            var factory = new StructureIndexesFactory();
            var indexes = factory.CreateIndexes(schemaStub, item).ToList();

            indexes.Count.Should().Be(1);
            indexes[0].Value.Should().Be(42);
        }