blob: 9f9c208a59d121ca856968b3b325d78b8aaa6eac (
plain)
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
|
using System;
using DSALib.Auxiliary;
using Moq;
using NUnit.Framework;
namespace NUnitTest.Auxiliary {
[TestFixture]
public class DiceTests {
[SetUp]
public void SetUp() {
mockRepository = new MockRepository(MockBehavior.Strict);
}
[TearDown]
public void TearDown() {
mockRepository.VerifyAll();
}
private MockRepository mockRepository;
private void CreateDice() {
}
[Test]
public void Roll_StateUnderTest_ExpectedBehavior() {
// Arrange
var d = 20;
// Act
var result = Dice.Roll(d);
// Assert
Assert.True(result > 0 && result < d + 1);
}
[Test]
public void Roll_StateUnderTest_ExpectedBehavior1() {
// Arrange
var input = "w";
// Act
Assert.Throws<ArgumentException>(() => Dice.Roll(input));
}
[Test]
public void Roll_zero_dice() {
// Arrange
var count = 0;
var d = 2;
// Act
var result = Dice.Roll(
count,
d);
// Assert
Assert.AreEqual(0, result);
}
}
}
|