public void Constructor_KeyPropertyIsNull_ThrowsException() { //Arrange Func <ITestObject, int> keyProperty = null; //Act var result = new PicnicCache <int, ITestObject>(keyProperty, _mockCacheable.Object); }
public void Constructor_KeyPropertyNameIsNull_ThrowsException() { //Arrange string keyPropertyName = null; //Act var result = new PicnicCache <int, ITestObject>(keyPropertyName, _mockCacheable.Object); }
public void Update_NullKeyPassed_ThrowsException() { //Arrange var cache = new PicnicCache <string, ITestObject>(x => x.Name, new Mock <ICacheable <string, ITestObject> >().Object); string key = null; //Act cache.Update(key, new object(), new Mock <Func <object, ITestObject, ITestObject> >().Object); }
public void Delete_NullKeyIsPassed_ThrowsException() { //Arrange var cache = new PicnicCache <string, ITestObject>(x => x.Name, new Mock <ICacheable <string, ITestObject> >().Object); string key = null; //Act cache.Delete(key); }
public void Constructor_ValidKeyPropertyName_FetchWorks() { //Arrange var cache = new PicnicCache <int, ITestObject>("Id", _mockCacheable.Object); var item = GetTestList(1).First(); _mockCacheable.Setup(c => c.Fetch(1)).Returns(item); //Act var result = cache.Fetch(1); //Assert Assert.AreEqual(item, result); }
public void Constructor_CacheableIsNull_ThrowsException() { //Act var result = new PicnicCache <int, ITestObject>("Test", null); }
public void Constructor_InvalidKeyPropertyName_ThrowsException() { //Act var result = new PicnicCache <int, ITestObject>("Test", _mockCacheable.Object); }