Ejemplo n.º 1
0
        public void EntityWithToOneAssociationWithIDField_OnlyIDPropertySet()
        {
            var entity = new EntityWithToOneAssociationWithIDField
            {
                EntityWithToOneAssociationWithIDFieldID = "entity10",
                AnotherEntityRefID = "33",
                AnotherEntityRef   = null
            };

            Serializer subject = SerializationTestHelper.CreateSerializer(typeof(EntityWithToOneAssociationWithIDField));
            JObject    doc     = subject.Serialize("2-update", "person-with-friends", entity);

            JsonAssert.FieldEquals("33", doc, "anotherEntityRefID");
        }
Ejemplo n.º 2
0
        public void EntityWithToOneAssociationWithIDField_OnlyToOneRefereceSet()
        {
            var entity = new EntityWithToOneAssociationWithIDField
            {
                EntityWithToOneAssociationWithIDFieldID = "entity10",
                AnotherEntityRef = new SimpleEntity
                {
                    SimpleEntityID = "22",
                    Name           = "hello",
                    Age            = 22
                }
            };

            Serializer subject = SerializationTestHelper.CreateSerializer(typeof(EntityWithToOneAssociationWithIDField));
            JObject    doc     = subject.Serialize("2-update", "person-with-friends", entity);

            JsonAssert.FieldEquals("22", doc, "anotherEntityRefID");
        }