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
32 changes: 32 additions & 0 deletions AY_TestTimeZoneConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using TestProject1.TimeConverter;

namespace TestProject1
{
[TestFixture]
public class TimeConverterTest
{
[Test]
public void Time_Converter_Return_EasternTime()
{
//Arrange
var timeAtTheMoment = DateTime.Now;
TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var timeAtTheMomentEast = TimeZoneInfo.ConvertTime(timeAtTheMoment, TimeZoneInfo.Local, easternZone);
//Assert
Assert.AreEqual(timeAtTheMomentEast, TimeZoneConverter.ConvertToEst(timeAtTheMoment));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you missed Act block, move execution ConvertToEst to this block

}
[Test]
public void Time_Converter_Return_UTCTime()
{
//Arrange
var timeAtTheMoment = DateTime.Now;
var timeAtTheMomentUTC = DateTime.UtcNow;
//Assert
Assert.AreEqual(timeAtTheMomentUTC.Date, TimeZoneConverter.ConvertToUtc(timeAtTheMoment).Date);
}
}
}