public void getRefTest()
        {
            InstanceMemory mem = new InstanceMemory();
            Station testStation = new TestStation();

            TestInstance1 t1 = new TestInstance1("123", "123-abc", "FILLED");
            TestInstance1 t2 = new TestInstance1("123", "123-def", "UNFILLED");
            TestInstance1 t3 = new TestInstance1("456", "456-abc", "NEW");
            TestInstance1 t4 = new TestInstance1("789", "789-abc", "FILLED");

            InstanceRef i1 = mem.AddRef(t1, testStation);
            InstanceRef i2 = mem.AddRef(t2, testStation);
            InstanceRef i3 = mem.AddRef(t3, testStation);
            InstanceRef i4 = mem.AddRef(t4, testStation);
            InstanceRef i2b = mem.AddRef(t2, testStation);
            InstanceRef i1c = mem.AddRef(t1, testStation);

            InstanceRef expected = i2b;
            InstanceRef actual;
            actual = mem.GetRef(i2b.Id);
            Assert.AreEqual(expected, actual);

            Assert.AreEqual("UNFILLED", actual.Instance.Status);
            Assert.AreEqual("123", actual.Instance.ID);
            Assert.AreEqual(t2, actual.Instance);
        }
Beispiel #2
0
        public void CommandTest_Station()
        {
            Pipeline p = getPipeline();
            Station s = p.Stations[0];

            StationCommand cmd = p.GetCommandByName("TEST_STATION_COMMAND");

            Assert.IsTrue(cmd.IsStationScope);

            CommandResult result = cmd.Execute(s);
            Assert.IsTrue(result.Success, "command failed to execute");

            StationCommand cmd2 = s.Commands[0];
            result = cmd2.Execute(s);
            Assert.IsTrue(result.Success, "command failed to execute");

            Assert.IsFalse(cmd.IsInstanceScope);
            Instance i =  new TestInstance1("id1","uid2","COMPLETE");
            result = cmd.Execute(s, i);
            Assert.IsFalse(result.Success);
        }