0 Comments

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; }
    }
}

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts