Example #1
0
        public void ShouldUpdate_WhenModelIsNullAndETagNotUsed_ReturnsTrue()
        {
            ETagRequestService service = GetService();
            var shouldUpdate           = service.ShouldUpdate(null);

            Assert.IsTrue(shouldUpdate);
        }
Example #2
0
        public void ShouldUpdate_WhenETagNotUsed_ReturnsTrue()
        {
            ETagRequestService service = GetService();
            var shouldUpdate           = service.ShouldUpdate(new object());

            Assert.IsTrue(shouldUpdate);
        }
Example #3
0
        public void ShouldUpdate_WhenETagDoesNotMatch_ReturnsFalse()
        {
            var mockETagService = new Mock <IETagService>();

            mockETagService.Setup(e => e.CheckETags(It.IsAny <string>(), It.IsAny <object>()))
            .Returns(ETagMatchResult.DoNotMatch);

            ETagRequestService service = GetService(mockETagService, ifMatchHeader: "a");
            var shouldUpdate           = service.ShouldUpdate(new object());

            Assert.IsFalse(shouldUpdate);
        }
Example #4
0
        public void ShouldUpdate_WhenModelIsNullAndETagIsUsed_ThrowsArgumentNullException()
        {
            ETagRequestService service = GetService(ifMatchHeader: "a");

            Assert.Throws <ArgumentNullException>(() => service.ShouldUpdate(null));
        }