-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAgeCalcTest.cs
34 lines (32 loc) · 1.1 KB
/
AgeCalcTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using Xunit;
namespace Faisalman.AgeCalc
{
public class AgeCalcTest
{
[Theory]
// example from readme
[InlineData(1970, 8, 21,
2014, 4, 30,
43, 8, 9)]
// issue #3
[InlineData(2020, 11, 26,
2020, 12, 25,
0, 0, 29)]
// issue #4
[InlineData(2019, 1, 2,
2020, 8, 31,
1, 7, 29)]
public void TestAge(int bdayYear, int bdayMonth, int bdayDay,
int cdayYear, int cdayMonth, int cdayDay,
int yearExpected, int monthExpected, int dayExpected)
{
DateTime bday = new DateTime(bdayYear, bdayMonth, bdayDay);
DateTime cday = new DateTime(cdayYear, cdayMonth, cdayDay);
Age ageActual = new Age(bday, cday);
Assert.Equal(yearExpected, ageActual.Years);
Assert.Equal(monthExpected, ageActual.Months);
Assert.Equal(dayExpected, ageActual.Days);
}
}
}