public void EntityConverter_ConvertLinkedObjectToJson_Succeeds()
        {
            // Create Object
            var newInvoice = new ComplexEntity
            {
                Currency    = "EUR",
                OrderDate   = new DateTime(2012, 10, 26),
                InvoiceTo   = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                Journal     = "50",
                OrderedBy   = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                Description = "NewInvoiceForEntityWithCollection"
            };

            var newInvoiceLine = new ComplexEntityLine
            {
                Description = "NewInvoiceForEntityWithCollection",
                Item        = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
            };

            var invoicelines = new List <ComplexEntityLine> {
                newInvoiceLine
            };

            newInvoice.Lines = invoicelines;

            var    entityConverter = new EntityConverter();
            string json            = entityConverter.ConvertObjectToJson(newInvoice, null);
            string expected        = JsonFileReader.GetJsonFromFileWithoutWhiteSpace("Expected_Json_Object_ComplexEntity_WithLinkedEntity.txt");

            Assert.AreEqual(expected, json);
        }
Exemplo n.º 2
0
        public void EntityConverter_ConvertLinkedObjectToJson_Succeeds()
        {
            // Create Object
            var newInvoice = new ComplexEntity
                {
                    Currency = "EUR",
                    OrderDate = new DateTime(2012, 10, 26),
                    InvoiceTo = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                    Journal = "50",
                    OrderedBy = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
                    Description = "NewInvoiceForEntityWithCollection"
                };

            var newInvoiceLine = new ComplexEntityLine
                {
                    Description = "NewInvoiceForEntityWithCollection",
                    Item = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
                };

            var invoicelines = new List<ComplexEntityLine> { newInvoiceLine };
            newInvoice.Lines = invoicelines;

            var entityConverter = new EntityConverter();
            string json = entityConverter.ConvertObjectToJson(newInvoice, null);
            string expected = JsonFileReader.GetJsonFromFileWithoutWhiteSpace("Expected_Json_Object_ComplexEntity_WithLinkedEntity.txt");
            Assert.AreEqual(expected, json);
        }