static MktInstrumentIrsRule() { var configReader = new ConfigFileTextReader("Configurations", "MarketInstrumentConventions", "Irs.cfg"); MktIrsRule = DataContractJsonObjectSerializer.Deserialize <MktIrsJson[]>(configReader.ReadAllText()) .ToDictionary(x => x.IndexType.ToIndexType(), x => x); }
public void TestJsonSerializerFormat() { var x = new[] { new MktDepositJson { IndexType = "Fr007", DepositInfo = new DepositInfo { StartDate = "2015-02-02" } }, new MktDepositJson { IndexType = "Fr001", DepositInfo = new DepositInfo { StartDate = "2015-02-22" } }, }; var strX = DataContractJsonObjectSerializer.Serialize(x); Console.WriteLine(strX); var configReader = new ConfigFileTextReader("Configurations", "MarketInstrumentConventions", "Deposit.cfg"); var depositRule2 = DataContractJsonObjectSerializer.Deserialize <MktDepositJson[]>(configReader.ReadAllText()) .ToDictionary(item => item.IndexType, item => item); Console.WriteLine(depositRule2.Count); Assert.AreEqual(depositRule2.Count, 9); }