public void LayerStack_OnSend_ErrorOnThrow() { var stack = new LayerStack <Dummy>(LoggerTests.BlackHole, new TestLayer_AlwaysThrows()); IBonded layerData; Error error = stack.OnSend(MessageType.Request, sendContext, out layerData); Assert.IsNotNull(error); Assert.AreEqual((int)ErrorCode.InternalServerError, error.error_code); }
public void LayerStack_OnSend_ErrorOnThrow() { var stack = new LayerStack <Dummy>(new TestLayer_AlwaysThrows()); Logger logger = LoggerTests.BlackHole; IBonded layerData; Error error = stack.OnSend(MessageType.REQUEST, sendContext, out layerData, logger); Assert.IsNotNull(error); Assert.AreEqual((int)ErrorCode.INTERNAL_SERVER_ERROR, error.error_code); }
public void LayerStack_OnSend_InvokesForwardOrder() { 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); IBonded layerData; Error error = stack.OnSend(MessageType.Request, sendContext, out layerData); Assert.IsNull(error); Assert.IsNotNull(layerData); Dummy realLayerData = layerData.Deserialize <Dummy>(); Assert.AreEqual(2, testList.Count); Assert.AreEqual(testLayer1.value, testList[0]); Assert.AreEqual(testLayer1.value + testLayer2.value, testList[1]); Assert.IsNotNull(realLayerData); Assert.AreEqual(testLayer1.value + testLayer2.value, realLayerData.string_value); }