-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnitTest1.cs
87 lines (72 loc) · 1.8 KB
/
UnitTest1.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using Xunit;
namespace _2020_06_03
{
public class FizzBuzz
{
public String fizzBuzz(int input)
{
if (input % 3 == 0 && input % 5 == 0)
{
return "FizzBuzz";
}
if (input % 3 == 0)
{
return "Fizz";
}
if (input % 5 == 0)
{
return "Buzz";
}
return input.ToString();
}
}
public class UnitTest1
{
[Theory]
[InlineData(1)]
[InlineData(2)]
public void GivesInputGivenInput(int input)
{
var f = new FizzBuzz();
String output = f.fizzBuzz(input);
Assert.Equal(input.ToString(), output);
}
[Theory]
[InlineData(3)]
[InlineData(6)]
public void GivesFizzGivenMultipleOf3(int input)
{
// Arrange
var f = new FizzBuzz();
// Act
String output = f.fizzBuzz(input);
// Assert
Assert.Equal("Fizz", output);
}
[Theory]
[InlineData(5)]
[InlineData(10)]
public void GivesBuzzGivenMultipleOf5(int input)
{
// Arrange
var f = new FizzBuzz();
// Act
String output = f.fizzBuzz(input);
// Assert
Assert.Equal("Buzz", output);
}
[Theory]
[InlineData(15)]
[InlineData(30)]
public void GivesFizzBuzzGivenMultipleOf3and5(int input)
{
// Arrange
var f = new FizzBuzz();
// Act
String output = f.fizzBuzz(input);
// Assert
Assert.Equal("FizzBuzz", output);
}
}
}