Exemple #1
0
        public void ValidatePassesWithUrlAndHeaderKey()
        {
            var processor = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object;
            var condition = new UrlHeaderValueTaskCondition
            {
                Url       = "http://somewhere",
                HeaderKey = "Key"
            };

            condition.Validate(null, ConfigurationTrace.Start(this), processor);

            this.mocks.VerifyAll();
        }
Exemple #2
0
        public void ValidateThrowsErrorsWithoutHeaderKey()
        {
            var processor = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object;
            var condition = new UrlHeaderValueTaskCondition
            {
                Url = "http://somewhere"
            };

            Mock.Get(processor).Setup(_processor => _processor.ProcessError("Header Key cannot be empty")).Verifiable();

            condition.Validate(null, ConfigurationTrace.Start(this), processor);

            this.mocks.VerifyAll();
        }
        public void ValidateThrowsErrorsWithoutHeaderKey()
        {
            var processor = this.mocks.StrictMock <IConfigurationErrorProcesser>();
            var condition = new UrlHeaderValueTaskCondition
            {
                Url = "http://somewhere"
            };

            Expect.Call(() => processor.ProcessError("Header Key cannot be empty"));

            this.mocks.ReplayAll();
            condition.Validate(null, ConfigurationTrace.Start(this), processor);

            this.mocks.VerifyAll();
        }
Exemple #4
0
        public void EvaluateReturnsTrueIfValuesMatch()
        {
            var webMock = this.mocks.Create <IWebFunctions>(MockBehavior.Strict).Object;

            Mock.Get(webMock).Setup(_webMock => _webMock.PingAndValidateHeaderValue("http://somewhere", "Key", "Value"))
            .Returns(true).Verifiable();
            var condition = new UrlHeaderValueTaskCondition
            {
                HeaderKey    = "Key",
                HeaderValue  = "Value",
                Url          = "http://somewhere",
                WebFunctions = webMock
            };
            var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsTrue(actual);
        }
        public void EvaluateReturnsTrueIfValuesMatch()
        {
            var webMock = this.mocks.StrictMock <IWebFunctions>();

            Expect.Call(webMock.PingAndValidateHeaderValue("http://somewhere", "Key", "Value"))
            .Return(true);
            var condition = new UrlHeaderValueTaskCondition
            {
                HeaderKey    = "Key",
                HeaderValue  = "Value",
                Url          = "http://somewhere",
                WebFunctions = webMock
            };
            var result = this.mocks.StrictMock <IIntegrationResult>();

            this.mocks.ReplayAll();
            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsTrue(actual);
        }