Esempio n. 1
0
        public void Put_ValueIsNull_ArgumentNullExceptionIsThrown()
        {
            var cacheMock = new Mock <ICacheManager <object> >();
            var sut       = new CacheManagerAdapter(cacheMock.Object);

            Assert.Throws <ArgumentNullException>(() => sut.Put("key", null));
        }
Esempio n. 2
0
        public void Put_ValueIsNull_ArgumentNullExceptionIsThrown()
        {
            var cacheMock  = new Mock <ICacheManager <string> >();
            var cacheMock2 = new Mock <ICacheManager <StoredHttpResponseMessage> >();

            var sut = new CacheManagerAdapter(cacheMock.Object, cacheMock2.Object);

            Assert.Throws <ArgumentNullException>(() => sut.Put("key", (string)null));
        }
Esempio n. 3
0
        public void Put_ParametersAreValid_CacheManagerPutIsCalled()
        {
            var cacheMock = new Mock <ICacheManager <object> >();

            cacheMock.Setup(x => x.Put("key", "value"));
            var sut = new CacheManagerAdapter(cacheMock.Object);

            sut.Put("key", "value");

            cacheMock.Verify(x => x.AddOrUpdate("key", "value", It.IsAny <Func <object, object> >()), Times.Once);
        }
Esempio n. 4
0
        public void Put_ResponsesAreValid_CacheManagerPutIsCalled()
        {
            var cacheMock  = new Mock <ICacheManager <string> >();
            var cacheMock2 = new Mock <ICacheManager <StoredHttpResponseMessage> >();

            cacheMock.Setup(x => x.Put("key", "value"));
            var sut = new CacheManagerAdapter(cacheMock.Object, cacheMock2.Object);

            sut.Put("key", new StoredHttpResponseMessage());

            cacheMock2.Verify(x => x.Put("key", It.IsAny <StoredHttpResponseMessage>()), Times.Once);
        }