Пример #1
0
        public void ShouldGetSingle_WhenModelIsNullAndETagNotUsed_ReturnsTrue()
        {
            ETagRequestService service = GetService();
            var shouldGet = service.ShouldGetSingle(null);

            Assert.IsTrue(shouldGet);
        }
Пример #2
0
        public void ShouldGetSingle_WhenETagNotUsed_ReturnsTrue()
        {
            ETagRequestService service = GetService();
            var shouldGet = service.ShouldGetSingle(new object());

            Assert.IsTrue(shouldGet);
        }
Пример #3
0
        public void ShouldGetSingle_WhenETagDoesNotMatch_ReturnsTrue()
        {
            var mockETagService = new Mock <IETagService>();

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

            ETagRequestService service = GetService(mockETagService, ifNoneMatchHeader: "a");
            var shouldGet = service.ShouldGetSingle(new object());

            Assert.IsTrue(shouldGet);
        }
Пример #4
0
        public void ShouldGetSingle_WhenModelIsNullAndETagIsUsed_ThrowsArgumentNullException()
        {
            ETagRequestService service = GetService(ifNoneMatchHeader: "a");

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