コード例 #1
0
        public void SelfHosted_Throws_When_NotSelfHosted()
        {
            var sha = new SelfHostedAttribute {
                SelfHostedOnly = true
            };

            Assert.Throws <BadRequestException>(() => sha.OnActionExecuting(GetContext(selfHosted: false)));
        }
コード例 #2
0
        public void SelfHosted_Success_When_SelfHosted()
        {
            var sha = new SelfHostedAttribute {
                SelfHostedOnly = true
            };

            sha.OnActionExecuting(GetContext(selfHosted: true));
        }
コード例 #3
0
        public void NotSelfHosted_Throws_When_SelfHosted()
        {
            // Arrange
            var sha = new SelfHostedAttribute {
                NotSelfHostedOnly = true
            };

            // Act & Assert
            Assert.Throws <BadRequestException>(() => sha.OnActionExecuting(GetContext(selfHosted: true)));
        }
コード例 #4
0
        public void SelfHosted_Success_When_SelfHosted()
        {
            // Arrange
            var sha = new SelfHostedAttribute {
                SelfHostedOnly = true
            };

            // Act
            sha.OnActionExecuting(GetContext(selfHosted: true));

            // Assert
            // The Assert here is just NOT throwing an exception
        }