Esempio n. 1
0
        public void CantAddAnItem()
        {
            const string propityName = "SomeName";
            var contentType = new ContentType();
            var item = new Item(contentType);
            const string propityValue = "SomeValue";

            var json = TypeSerializer.SerializeToString(item);

            Console.WriteLine(json);

            Assert.That(item.AddPropity(propityName, propityValue), Is.False);
        }
Esempio n. 2
0
        public void CanSerializeToJSONFromItem_ThenCanDeserializeToSomeType()
        {
            var contentType = new ContentType
            {
                Name = "SomeName",
                Properties = new[] { new Property { Name = "StringProp", Type = "string", DefaultValue = "Hello" } },
                Namespace = "SomeNamesapce"
            };

            var item = new Item(contentType);

            item.AddPropity("StringProp", "StringPropTest");

            var json = JsonSerializer.SerializeToString(item);

            Console.WriteLine(json);

            var t = JsonSerializer.DeserializeFromString<SomeType>(json);

            //Assert.That(t.StringProp, Is.EqualTo("StringPropTest"));

            var tt = JsonSerializer.DeserializeFromString<ExpandoObject>(json);
            var ttt = new Item(tt);
        }
Esempio n. 3
0
 public Item(ContentType contentType)
 {
     SOmeProp = "fdafsda";
     _contentType = contentType;
 }
Esempio n. 4
0
        private ContentType BuildContentType(ClassType classType)
        {
            var symbol = classType.SemanticModel.GetDeclaredSymbol(classType.ClassDeclarationSyntax);

            var contentType = new ContentType
            {
                Name = symbol.ToMinimallyQualified(),
                Namespace = symbol.GetNamespace()
            };

            foreach (var property in classType.DocumentRoot.PropertyDeclarationNodes())
            {
                if (IsNotPublicModifier(property))
                    continue;

                contentType.Properties.Add(property.GetFurnaceContentTypeProperty());
            }

            ObjectTypeFactory.AddFurnaceType(contentType.FullName);

            return contentType;
        }
Esempio n. 5
0
 public void WithNoNameSetUp()
 {
     ContentType = new ContentType { Namespace = ContentTypeNamespace, Properties = ContentTypeProperties };
 }
Esempio n. 6
0
 public void PropertiesSetUp()
 {
     ContentType = new ContentType { Name = ContentTypeName, Namespace = ContentTypeNamespace };
 }
Esempio n. 7
0
 public void NameOrNamespaceOrPropertiesSetUp()
 {
     ContentType = new ContentType();
 }
Esempio n. 8
0
 public void NameOrNamespaceSetUp()
 {
     ContentType = new ContentType { Properties = ContentTypeProperties };
 }
 public void WithNameAndNamespaceTestsSetUp()
 {
     ContentType = new ContentType { Name = ContentTypeName, Namespace = ContentTypeNamespace };
 }