예제 #1
0
        public void ToStringTest()
        {
            var plainTcoMessage = new PlainTcoMessage()
            {
                Text = "Hey", Category = (short)eMessageCategory.Critical
            };

            var actual = plainTcoMessage.ToString();

            Assert.AreEqual("1/1/0001 12:00:00 AM : 'Hey' | Critical ()", actual.ToString());
        }
예제 #2
0
        public void SelectedMessageTest()
        {
            var twin    = new TcoContext(new MockRootObject(), string.Empty, string.Empty);
            var vm      = new TcoDiagnosticsViewModel(twin);
            var message = new PlainTcoMessage()
            {
                Text = "message text"
            };

            vm.SelectedMessage = message;

            Assert.AreEqual(vm.SelectedMessage.ToString(), message.ToString());
        }
예제 #3
0
        public void MessageDisplayTest()
        {
            var context = new TcoContext(new MockRootObject(), "context", "context");
            var objL1   = new TcoObject(context, "objL1", "objL1");
            var objL2   = new TcoObject(objL1, "objL2", "objL2");

            context.MessageHandler.DiagnosticsDepth = 1000;
            objL1.MessageHandler.DiagnosticsDepth   = 1000;
            objL2.MessageHandler.DiagnosticsDepth   = 1000;

            context._startCycleCount.Cyclic        = 1458;
            objL1._messenger._mime.Category.Cyclic = (short)eMessageCategory.Catastrophic;
            objL1._messenger._mime.Cycle.Cyclic    = context._startCycleCount.LastValue;
            objL1._messenger._mime.Text.Cyclic     = "hello from sequence";

            objL2._messenger._mime.Category.Cyclic = (short)eMessageCategory.Catastrophic;
            objL2._messenger._mime.Cycle.Cyclic    = context._startCycleCount.LastValue;
            objL2._messenger._mime.Text.Cyclic     = "hello from mode controller";

            context.Write();

            var vm = new TcoDiagnosticsViewModel(context);

            vm.MinMessageCategoryFilter = eMessageCategory.Info;

            vm.UpdateMessages();

            Assert.AreEqual(2, vm.MessageDisplay.Count());

            var expected = new PlainTcoMessage();

            objL1._messenger._mime.FlushOnlineToPlain(expected);
            expected.Source = objL1.Symbol;

            Assert.AreEqual(expected.ToString(), vm.MessageDisplay.ToList()[0].ToString());

            expected = new PlainTcoMessage();
            objL2._messenger._mime.FlushOnlineToPlain(expected);
            expected.Source = objL2.Symbol;

            Assert.AreEqual(expected.ToString(), vm.MessageDisplay.ToList()[1].ToString());
        }