Exemple #1
0
        public override T Process(T port)
        {
            foreach (var policy in port.Policies)
            {
                PolicyExecuter.ExecutePolicy(policy);
            }

            return(port);
        }
        public void PolicyFilterNoPolicySuccessTest()
        {
            Policy policy = new Policy
            {
                Type       = PolicyType.NONE,
                Attributes = new Dictionary <string, string> {
                }
            };

            var Actual = PolicyExecuter.ExecutePolicy(policy);

            Assert.True(Actual);
        }
        public void PolicyFilterDelaysRequestByFiveSecondsTestSuccess()
        {
            Policy policy = new Policy
            {
                Type       = PolicyType.DELAYRESPONSE,
                Attributes = new Dictionary <string, string>
                {
                    ["delay"] = "5000"
                }
            };

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            PolicyExecuter.ExecutePolicy(policy);
            stopwatch.Stop();
            Assert.True(stopwatch.ElapsedMilliseconds >= 5000);
        }