public void GetIndexes_WhenItemHasNulledGuidId_ReturnsNoIndex()
        {
            var item = new WithNullableGuidId { StructureId = null };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom<WithNullableGuidId>();

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

            Assert.AreEqual(0, indexes.Count);
        }
        public void GetIndexes_WhenNullableGuidIdHasValue_ReturnsId()
        {
            var id = Guid.Parse("1F0E8C1D-7AF5-418F-A6F6-A40B7F31CB00");
            var item = new WithNullableGuidId { StructureId = id };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom<WithNullableGuidId>();

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

            Assert.AreEqual(id, indexes.Single(i => i.Path == "StructureId").Value);
        }
Esempio n. 3
0
        public void GetIndexes_WhenItemHasNulledGuidId_ReturnsNoIndex()
        {
            var item = new WithNullableGuidId {
                StructureId = null
            };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom <WithNullableGuidId>();

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

            Assert.AreEqual(0, indexes.Count);
        }
Esempio n. 4
0
        public void GetIndexes_WhenNullableGuidIdHasValue_ReturnsId()
        {
            var id   = Guid.Parse("1F0E8C1D-7AF5-418F-A6F6-A40B7F31CB00");
            var item = new WithNullableGuidId {
                StructureId = id
            };
            var schemaStub = StructureSchemaTestFactory.CreateRealFrom <WithNullableGuidId>();

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

            Assert.AreEqual(id, indexes.Single(i => i.Path == "StructureId").Value);
        }