10 April, 2013
0 Comments
1 category
using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; namespace Research.Rli.Tests { [TestClass] public class ResearchTester { [TestMethod] public void Test() { string json = @"{""date"":""2013-04-10T14:52:43.207Z""}"; Dto dto = JsonConvert.DeserializeObject<Dto>(json); string localTime = dto.date.ToLocalTime().ToString(); Assert.AreEqual("10-4-2013 16:52:43", localTime); // In the Netherlands this test will succeed. } } public class Dto { public DateTime date { get; set; } } }
Tags: C#
Category: Uncategorized