SHOW:
|
|
- or go back to the newest paste.
| 1 | using System; | |
| 2 | using Freelancers.Infrastructure.Storage; | |
| 3 | using Xunit; | |
| 4 | ||
| 5 | namespace Freelancers.Infrastructure.Tests.Storage | |
| 6 | {
| |
| 7 | public class CacheStorageFacts | |
| 8 | {
| |
| 9 | - | public class Remove |
| 9 | + | private CacheStorage cacheStorage; |
| 10 | ||
| 11 | - | [Fact] |
| 11 | + | [SetUp] |
| 12 | - | public void WithEmptyKeyThrowsArgumentException() |
| 12 | + | public void SetUp() |
| 13 | - | {
|
| 13 | + | {
|
| 14 | - | // Arrange |
| 14 | + | cacheStorage = new CacheStorage(); |
| 15 | - | var cacheStorage = new CacheStorage(); |
| 15 | + | } |
| 16 | - | // Act |
| 16 | + | |
| 17 | - | // Assert |
| 17 | + | [Fact] |
| 18 | - | Assert.Throws<ArgumentException>(() => cacheStorage.Remove(""));
|
| 18 | + | public void Remove_WithEmptyKey_ThrowsArgumentException() |
| 19 | - | } |
| 19 | + | |
| 20 | Assert.Throws<ArgumentException>(() => cacheStorage.Remove(""));
| |
| 21 | } | |
| 22 | - | public class Store |
| 22 | + | |
| 23 | [Fact] | |
| 24 | - | [Fact] |
| 24 | + | public void Store_WithEmptyKeyThrowsArgumentException() |
| 25 | - | public void WithEmptyKeyThrowsArgumentException() |
| 25 | + | |
| 26 | - | {
|
| 26 | + | Assert.Throws<ArgumentException>(() => cacheStorage.Store("", "test"));
|
| 27 | - | // Arrange |
| 27 | + | |
| 28 | - | var cacheStorage = new CacheStorage(); |
| 28 | + | |
| 29 | - | // Act |
| 29 | + | [Fact] |
| 30 | - | // Assert |
| 30 | + | public void Store_WithNullDataThrowsArgumentException() |
| 31 | - | Assert.Throws<ArgumentException>(() => cacheStorage.Store("", "test"));
|
| 31 | + | |
| 32 | - | } |
| 32 | + | Assert.Throws<ArgumentNullException>(() => cacheStorage.Store("test", null));
|
| 33 | - | [Fact] |
| 33 | + | |
| 34 | - | public void WithNullDataThrowsArgumentException() |
| 34 | + | |
| 35 | - | {
|
| 35 | + | [Fact] |
| 36 | - | // Arrange |
| 36 | + | public void Retrieve_WithEmptyKeyThrowsArgumentException() |
| 37 | - | var cacheStorage = new CacheStorage(); |
| 37 | + | |
| 38 | - | // Act |
| 38 | + | Assert.Throws<ArgumentException>(() => cacheStorage.Retrieve<object>(""));
|
| 39 | - | // Assert |
| 39 | + | |
| 40 | - | Assert.Throws<ArgumentNullException>(() => cacheStorage.Store("test", null));
|
| 40 | + | |
| 41 | - | } |
| 41 | + |