Skip to content

Instantly share code, notes, and snippets.

@OksanaH

OksanaH/Tests.cs Secret

Created May 27, 2021 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OksanaH/81cd28e1e029d5604bd05a1b6755570d to your computer and use it in GitHub Desktop.
Save OksanaH/81cd28e1e029d5604bd05a1b6755570d to your computer and use it in GitHub Desktop.
Tests.cs
public class UnitTests
{
[Fact]
public void DateInPast_ReturnsCorrectResult()
{
var controller = new HomeController();
var date = new DateTime(1983, 2, 3);
var expected = $"{String.Format("{0:d}", date)} was Thursday";
var actual = controller.Get(date) as OkObjectResult;
Assert.Equal(expected, actual.Value);
}
[Fact]
public void DateInFuture_ReturnsCorrectResult()
{
var controller = new HomeController();
var date = new DateTime(2033, 12, 9);
var expected = $"{String.Format("{0:d}", date)} will be Friday";
var actual = controller.Get(date) as OkObjectResult;
Assert.Equal(expected, actual.Value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment