DefconDotNet

Untitled

Feb 7th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
  10.         {
  11.             private readonly CacheStorage _cacheStorage;
  12.  
  13.             public Remove()
  14.             {
  15.                 _cacheStorage = new CacheStorage();
  16.             }
  17.  
  18.             [Fact]
  19.             public void WithEmptyKeyThrowsArgumentException()
  20.             {
  21.                 Assert.Throws<ArgumentException>(() => _cacheStorage.Remove(""));
  22.             }
  23.         }
  24.  
  25.         public class Store
  26.         {
  27.             private readonly CacheStorage _cacheStorage;
  28.  
  29.             public Store()
  30.             {
  31.                 _cacheStorage = new CacheStorage();
  32.             }
  33.  
  34.             [Fact]
  35.             public void WithEmptyKeyThrowsArgumentException()
  36.             {
  37.                 Assert.Throws<ArgumentException>(() => _cacheStorage.Store("", "test"));
  38.             }
  39.  
  40.             [Fact]
  41.             public void WithNullDataThrowsArgumentException()
  42.             {
  43.                 Assert.Throws<ArgumentNullException>(() => _cacheStorage.Store("test", null));
  44.             }
  45.         }
  46.  
  47.         public class Retrieve
  48.         {
  49.             private readonly CacheStorage _cacheStorage;
  50.  
  51.             public Retrieve()
  52.             {
  53.                 _cacheStorage = new CacheStorage();
  54.             }
  55.  
  56.             [Fact]
  57.             public void WithEmptyKeyThrowsArgumentException()
  58.             {
  59.                 Assert.Throws<ArgumentException>(() => _cacheStorage.Retrieve<object>(""));
  60.             }
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment