Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions SR_TimeZoneTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using NUnit.Framework;
using System;
using TestProject1.TimeConverter;

namespace TestProject1
{
[TestFixture]
public class TimeZoneTest
{
[Test]
public void TestConvertToEst()
{
////Arrange
DateTime currentTime = DateTime.Now;
TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
DateTime correctEstTime = TimeZoneInfo.ConvertTime(currentTime, TimeZoneInfo.Local, easternZone);

////Act
DateTime testedEstTime = TimeZoneConverter.ConvertToEst(currentTime);

////Assert
Assert.AreEqual(correctEstTime, testedEstTime);
}

[Test]
public void TestConvertToUtc()
{
////Arrange
DateTime currentTime = DateTime.Now;
DateTime correctUtcTime = TimeZoneInfo.ConvertTimeToUtc(currentTime);

////Act
DateTime testedUtcTime = TimeZoneConverter.ConvertToUtc(currentTime);

////Assert
Assert.AreEqual(correctUtcTime, testedUtcTime);
}
}
}