using System; using System.Collections.Generic; using JsonConverterTest; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace JsonConverterTest { [TestClass] public class UnitTest1 { /// /// To Get a instance of object Company /// /// instance of company private Comapany GetCompanyObject() { return new Comapany { Name = "CSG Solutions India Pvt Ltd", TotalEmployee = 50, Established = DateTime.Now, IsGovtOrganisation = false, TotalAsset = 20000000, Branches = new List { new Branch { Country = "India", State = "Karnataka", Address = new Location { BuildingName = "Sri Hari Tower", Street = "2nd Main Road", ZipCode = 560016 } }, new Branch { Country = "USA", State = "Germantown", Address = new Location { BuildingName = "Zinc Tower", Street = "Germantown Road", ZipCode = 50001 } } }, Departments = new Dictionary { { "Engineering", new Department { DeptId = 001, DeptName = "Super Engineers" } }, { "Support", new Department { DeptId = 002, DeptName = "24*7 Tech Support" } }, { "Marketings", new Department { DeptId = 003, DeptName = "Tech Mavens" } } }, Management = new Management { CEO = "Tarun Kumar Rajak", Founder = "Ashok Kisku" } }; } /// /// To Test Serialize functionality /// [TestMethod] public void TestMethod1() { var json = JsonConverter.Serialize(GetCompanyObject()); System.IO.File.WriteAllText(@"C:\Users\Public\Documents\Company.json", json); } } }