forked from TheAlgorithms/C-Sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnrolledLinkedListNodeTests.cs
60 lines (44 loc) · 1.31 KB
/
UnrolledLinkedListNodeTests.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
using System;
using DataStructures.UnrolledList;
using FluentAssertions;
using NUnit.Framework;
namespace DataStructures.Tests.UnrolledList;
public class UnrolledLinkedListNodeTests
{
[Test]
public void GetAndSet_SetItemNodeAndGetIt_ReturnExpectedItem()
{
var node = new UnrolledLinkedListNode(6);
node.Set(0, 1);
var result = node.Get(0);
result.Should().Be(1);
}
[Test]
public void Get_GetLowIndex_ThrowArgumentException()
{
var node = new UnrolledLinkedListNode(6);
Action action = () => node.Get(-1);
action.Should().Throw<ArgumentException>();
}
[Test]
public void Get_GetHighIndex_ThrowArgumentException()
{
var node = new UnrolledLinkedListNode(6);
Action action = () => node.Get(7);
action.Should().Throw<ArgumentException>();
}
[Test]
public void Set_SetLowIndex_ThrowArgumentException()
{
var node = new UnrolledLinkedListNode(6);
Action action = () => node.Set(-1, 0);
action.Should().Throw<ArgumentException>();
}
[Test]
public void Set_SetHighIndex_ThrowArgumentException()
{
var node = new UnrolledLinkedListNode(6);
Action action = () => node.Set(7, 0);
action.Should().Throw<ArgumentException>();
}
}