-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSection_03_Tests.fs
36 lines (31 loc) · 1.03 KB
/
Section_03_Tests.fs
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
35
36
namespace FPinFSharp.Chapter_01.UnitTests
open FPinFSharp.Chapter_01.Section_03
open FPinFSharp.Chapter_01.UnitTests
open Xunit
module Section_03_Tests =
[<Fact>]
let ``Should calculate a circle area (v3)`` () =
let radius = 10
let expectedResult = 314.15926535897933
let actualResult = calculateCircleAreaUsingAnonymousFunction radius
Assert.Equal(expectedResult, actualResult)
type MonthsAndDaysTestData() =
inherit TestDataBase([
[| 1; 31 |]
[| 2; 28 |]
[| 3; 31 |]
[| 4; 30 |]
[| 5; 31 |]
[| 6; 30 |]
[| 7; 31 |]
[| 8; 31 |]
[| 9; 30 |]
[| 10; 31 |]
[| 11; 30 |]
[| 12; 31 |]
])
[<Theory>]
[<ClassData(typeof<MonthsAndDaysTestData>)>]
let ``Should get a number of days by a month number`` (month: int, expectedResult: int) =
let actualResult = daysNumberByMonth month
Assert.Equal(expectedResult, actualResult)