void EDoorOrderTest(STR_EDoor_Accessor edoor) { // 주문이 안나가는 경우에 대해서 꼼꼼히 점검해본다. EDoorMonitorEnterController_Accessor controller = new EDoorMonitorEnterController_Accessor( new PrivateObject(edoor._monitorController)); controller.BlockAfterCancel = false; EDoorEachMonitorEnterController_Accessor callEach_0 = new EDoorEachMonitorEnterController_Accessor( new PrivateObject(GetController(controller._eachControllers, CallPutFlag.Call, 0))); EDoorEachMonitorEnterController_Accessor callEach_1 = new EDoorEachMonitorEnterController_Accessor( new PrivateObject(GetController(controller._eachControllers, CallPutFlag.Call, 1))); EDoorEachMonitorEnterController_Accessor putEach_0 = new EDoorEachMonitorEnterController_Accessor( new PrivateObject(GetController(controller._eachControllers, CallPutFlag.Put, 0))); EDoorCenterData centerData = edoor._centerData; // run test Assert.AreEqual(controller._eachControllers.Count, controller.Run(centerData)); MonitorState rawMS_0 = callEach_0._monitorEnter as MonitorState; MonitorState_Accessor msCallEach_0 = new MonitorState_Accessor(new PrivateObject(rawMS_0)); MonitorState rawMS_1 = callEach_1._monitorEnter as MonitorState; MonitorState_Accessor msCallEach_1 = new MonitorState_Accessor(new PrivateObject(rawMS_1)); MonitorState rawMS_2 = putEach_0._monitorEnter as MonitorState; MonitorState_Accessor msPutEach_0 = new MonitorState_Accessor(new PrivateObject(rawMS_2)); MonitorDataThisTurnTest(callEach_0, msCallEach_0, centerData); MonitorDataThisTurnTest(putEach_0, msPutEach_0, centerData); MonitorStateRunTest(callEach_0, msCallEach_0, centerData); Assert.AreEqual(1, centerData.GetAvailableChannelCount()); MonitorStateRunTest(putEach_0, msPutEach_0, centerData); Assert.AreEqual(0, centerData.GetAvailableChannelCount()); // 2개 다 나갔다. Valid하지 않다. Assert.AreEqual(false, controller.IsValid(centerData)); // run test Assert.AreEqual(0, controller.Run(centerData)); // entering test EnteringStateTest(callEach_0, centerData); Assert.AreEqual(true, controller.IsValid(centerData)); EnteringStateTest(putEach_0, centerData); Assert.AreEqual(true, controller.IsValid(centerData)); // rebalance test RebalanceStateTest(callEach_0, centerData); Assert.AreEqual(true, controller.IsValid(centerData)); RebalanceStateTest(putEach_0, centerData); Assert.AreEqual(false, controller.IsValid(centerData)); // cancel done test CencelOrderDoneTest(centerData, callEach_0); }
STR_EDoor_Accessor EDoorCreateTest() { // STR_EDoor를 생성한다. 기본값을 이용한다. STR_EDoor builder = new STR_EDoor(); String input = builder.GetInputTemplate(); STR_EDoor edoor = builder.CreateStrategy(input, "EDoorTest") as STR_EDoor; STR_EDoor_Accessor acc = new STR_EDoor_Accessor(new PrivateObject(edoor)); // acc를 이용해서 내부 값이 정상적인지 확인한다. Assert.AreEqual(acc._strategyName, "EDoorTest"); EDoorCenterDataTest(acc._centerData); EDoorMonitorEnterControllerTest(acc._monitorController); return acc; }