Пример #1
0
        public void TestConcreteNonIdentifiableReferenceableListSerialization()
        {
            var obj  = new NonIdentifiableCollectionContainer();
            var item = new Referenceable {
                Id = GuidGenerator.Get(1), Value = "Test"
            };

            obj.ConcreteRefList.Add(item);
            obj.ConcreteRefList.Add(item);
            var objectReferences = new YamlAssetMetadata <Guid>();
            var path             = new YamlAssetPath();

            path.PushMember(nameof(CollectionContainer.ConcreteRefList));
            path.PushIndex(0);
            objectReferences.Set(path, GuidGenerator.Get(1));
            var yaml = SerializeAsString(obj, objectReferences);

            Assert.AreEqual(ConcreteNonIdentifiableReferenceableListYaml, yaml);
        }
Пример #2
0
        public void TestAbstractNonIdentifiableReferenceableDictionarySerialization()
        {
            var obj  = new NonIdentifiableCollectionContainer();
            var item = new Referenceable {
                Id = GuidGenerator.Get(1), Value = "Test"
            };

            obj.AbstractRefDictionary.Add("Item1", item);
            obj.AbstractRefDictionary.Add("Item2", item);
            var objectReferences = new YamlAssetMetadata <Guid>();
            var path             = new YamlAssetPath();

            path.PushMember(nameof(CollectionContainer.AbstractRefDictionary));
            path.PushIndex("Item1");
            objectReferences.Set(path, GuidGenerator.Get(1));
            var yaml = SerializeAsString(obj, objectReferences);

            Assert.AreEqual(AbstractNonIdentifiableReferenceableDictionaryYaml, yaml);
        }
Пример #3
0
        public void TestConcreteNonIdentifiableReferenceableDictionarySerialization()
        {
            var obj  = new NonIdentifiableCollectionContainer();
            var item = new Referenceable {
                Id = GuidGenerator.Get(1), Value = "Test"
            };

            obj.ConcreteRefDictionary.Add("Item1", item);
            obj.ConcreteRefDictionary.Add("Item2", item);
            var objectReferences = new YamlAssetMetadata <Guid>();
            var ids = CollectionItemIdHelper.GetCollectionItemIds(obj.ConcreteRefDictionary);

            ids["Item1"] = IdentifierGenerator.Get(1);
            ids["Item2"] = IdentifierGenerator.Get(2);
            var path = new YamlAssetPath();

            path.PushMember(nameof(CollectionContainer.ConcreteRefDictionary));
            path.PushIndex("Item1");
            objectReferences.Set(path, GuidGenerator.Get(1));
            var yaml = SerializeAsString(obj, objectReferences);

            Assert.Equal(ConcreteNonIdentifiableReferenceableDictionaryYaml, yaml);
        }