Skip to content

Commit 1cfdbd0

Browse files
committed
Added file dictionaries from mockaroo and briandunning.com
1 parent cf7f4ee commit 1cfdbd0

64 files changed

Lines changed: 30656 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,62 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
3+
using NTestDataBuilder.DataSources.Dictionaries;
4+
using Shouldly;
5+
using Xunit;
56

67
namespace NTestDataBuilder.Tests.DataSources.Dictionaries
78
{
8-
public class CacheTests
9+
public class CacheTests : IDisposable
910
{
1011
public CacheTests()
1112
{
12-
Cache.Clear()
13+
Cache.Clear();
14+
}
15+
16+
[Fact]
17+
public void WhenRequestingAnItemNotInTheCache_ThenReturnsNull()
18+
{
19+
Cache.Get("SomethingThatDoesNotExist").ShouldBe(null);
20+
}
21+
22+
[Fact]
23+
public void WhenAddingAnItemToTheCache_ThenTheItemIsPersistedInTheCache()
24+
{
25+
var collection = new List<string>{"item1", "item2"};
26+
Cache.Set("myCollection", collection);
27+
Cache.Get("myCollection").ShouldBeSameAs(collection);
28+
}
29+
30+
[Fact]
31+
public void WhenAddingAnItemToTheCacheWithTheSameKeyAsAnExistingItem_ThenTheOriginalItemIsReplacedWithTheNewItem()
32+
{
33+
var collection = new List<string> { "item1", "item2" };
34+
var collection2 = new List<string> { "item3" };
35+
Cache.Set("myCollection", collection);
36+
37+
Cache.Set("myCollection", collection2);
38+
39+
Cache.Get("myCollection").ShouldBeSameAs(collection2);
40+
}
41+
42+
[Fact]
43+
public void WhenCheckingCacheContainesAnItemThatIsInCache_ThenShouldReturnTrue()
44+
{
45+
var collection = new List<string> {"item1", "item2"};
46+
Cache.Set("myCollection", collection);
47+
Cache.Contains("myCollection").ShouldBe(true);
48+
}
49+
50+
[Fact]
51+
public void WhenCheckingCacheContainesAnItemThatIsNotInCache_ThenShouldReturnFalse()
52+
{
53+
Cache.Contains("SomethingThatDoesNotExist").ShouldBe(false);
54+
}
55+
56+
57+
public void Dispose()
58+
{
59+
Cache.Clear();
1360
}
1461
}
1562
}

0 commit comments

Comments
 (0)