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); }
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); }
public Item(ContentType contentType) { SOmeProp = "fdafsda"; _contentType = contentType; }
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; }
public void WithNoNameSetUp() { ContentType = new ContentType { Namespace = ContentTypeNamespace, Properties = ContentTypeProperties }; }
public void PropertiesSetUp() { ContentType = new ContentType { Name = ContentTypeName, Namespace = ContentTypeNamespace }; }
public void NameOrNamespaceOrPropertiesSetUp() { ContentType = new ContentType(); }
public void NameOrNamespaceSetUp() { ContentType = new ContentType { Properties = ContentTypeProperties }; }
public void WithNameAndNamespaceTestsSetUp() { ContentType = new ContentType { Name = ContentTypeName, Namespace = ContentTypeNamespace }; }