-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test nodelist * usings * nodelist ---------
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using BitFaster.Caching.Lfu; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace BitFaster.Caching.UnitTests.Lfu | ||
{ | ||
public class LfuNodeListTests | ||
{ | ||
[Fact] | ||
public void WhenPreviousNullLastReturnsNull() | ||
{ | ||
var list = new LfuNodeList<int, int>(); | ||
|
||
list.Last.Should().BeNull(); | ||
} | ||
|
||
[Fact] | ||
public void WhenPreviousExistsLastReturnsPrevious() | ||
{ | ||
var list = new LfuNodeList<int, int>(); | ||
var node1 = new LfuNode<int, int>(1, 1); | ||
var node2 = new LfuNode<int, int>(2, 2); | ||
|
||
list.AddLast(node1); | ||
list.AddLast(node2); | ||
|
||
list.Last.Should().BeSameAs(node2); | ||
} | ||
|
||
[Fact] | ||
public void WhenPreviousExistsNodePreviousReturnsPrevious() | ||
{ | ||
var list = new LfuNodeList<int, int>(); | ||
var node1 = new LfuNode<int, int>(1, 1); | ||
var node2 = new LfuNode<int, int>(2, 2); | ||
|
||
list.AddLast(node1); | ||
list.AddLast(node2); | ||
|
||
node2.Previous.Should().BeSameAs(node1); | ||
} | ||
|
||
[Fact] | ||
public void WhenHeadNodePreviousReturnsNull() | ||
{ | ||
var list = new LfuNodeList<int, int>(); | ||
var node1 = new LfuNode<int, int>(1, 1); | ||
var node2 = new LfuNode<int, int>(2, 2); | ||
|
||
list.AddLast(node1); | ||
list.AddLast(node2); | ||
|
||
node1.Previous.Should().BeNull(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("BitFaster.Caching.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f55849315b02d525d40701eee5d8eba39e6a517644e8af3fa15141eab7058e76be808e36cfee8d7e071b5aac37bd5e45c67971602680f7bfc26d8c9ebca95dd33b4e3f17a4c28b01268ee6b110ad7e2106ab8ffd1c7be3143192527ce5f639395e46ab086518e881706c6ee9eb96f0263aa34e5152cf5aecf657d463fecf62ca")] |