This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace EncodingTests | |
{ | |
[TestClass] | |
public class EncodeTests | |
{ | |
[TestMethod] | |
public void HtmlTags_WhenHtmlEncoded_WillReturnHTMLEncodedOutput() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the time zone to convert to | |
var timeZone = DateTimeZoneProviders.Tzdb["US/Eastern"]; | |
// the date as UTC - this could be from a data store | |
var fakeUtcDate = new DateTime(2015, 11, 01, 07, 30, 00); | |
// convert to instant from UTC - see http://stackoverflow.com/questions/20807799/using-nodatime-how-to-convert-an-instant-to-the-corresponding-systems-zoneddat | |
var instant = Instant.FromDateTimeUtc(DateTime.SpecifyKind(fakeUtcDate, DateTimeKind.Utc)); | |
var result = instant.InZone(timeZone).ToDateTimeUnspecified(); |