예제 #1
0
        public void Constructor_KeyPropertyIsNull_ThrowsException()
        {
            //Arrange
            Func <ITestObject, int> keyProperty = null;

            //Act
            var result = new PicnicCache <int, ITestObject>(keyProperty, _mockCacheable.Object);
        }
예제 #2
0
        public void Constructor_KeyPropertyNameIsNull_ThrowsException()
        {
            //Arrange
            string keyPropertyName = null;

            //Act
            var result = new PicnicCache <int, ITestObject>(keyPropertyName, _mockCacheable.Object);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public void Constructor_CacheableIsNull_ThrowsException()
 {
     //Act
     var result = new PicnicCache <int, ITestObject>("Test", null);
 }
예제 #7
0
 public void Constructor_InvalidKeyPropertyName_ThrowsException()
 {
     //Act
     var result = new PicnicCache <int, ITestObject>("Test", _mockCacheable.Object);
 }