DefconDotNet

Untitled

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