Example #1
0
        public void LayerStack_OnReceive_ErrorOnThrow()
        {
            var stack = new LayerStack <Dummy>(LoggerTests.BlackHole, new TestLayer_AlwaysThrows());

            Error error = stack.OnReceive(MessageType.Request, receiveContext, CreateBondedTestData(initialReceiveValue));

            Assert.IsNotNull(error);
            Assert.AreEqual((int)ErrorCode.InternalServerError, error.error_code);
        }
        public void LayerStack_OnReceive_ErrorOnThrow()
        {
            var    stack  = new LayerStack <Dummy>(new TestLayer_AlwaysThrows());
            Logger logger = LoggerTests.BlackHole;
            Error  error  = stack.OnReceive(MessageType.REQUEST, receiveContext, CreateBondedTestData(initialReceiveValue), logger);

            Assert.IsNotNull(error);
            Assert.AreEqual((int)ErrorCode.INTERNAL_SERVER_ERROR, error.error_code);
        }
Example #3
0
        public void LayerStack_OnReceive_InvokesReverseOrder()
        {
            var testList   = new List <string>();
            var testLayer1 = new TestLayer_Append("foo", testList);
            var testLayer2 = new TestLayer_Append("bar", testList);
            var stack      = new LayerStack <Dummy>(testLayer1, testLayer2);

            Error error = stack.OnReceive(MessageType.Request, receiveContext, CreateBondedTestData(initialReceiveValue));

            Assert.IsNull(error);
            Assert.AreEqual(2, testList.Count);
            Assert.AreEqual(initialReceiveValue + testLayer2.value, testList[0]);
            Assert.AreEqual(initialReceiveValue + testLayer2.value + testLayer1.value, testList[1]);
        }