Exemplo n.º 1
0
        public void LogicalOrCommandTest()
        {
            SwitchVM      switchOne = new SwitchVM();
            SwitchVM      switchTwo = new SwitchVM();
            LogicalBaseVM or        = LogicalBaseVM.CreateLogicalOr();

            ICommand switchingSwitchOne = switchOne.SwitchingCommand;

            switchingSwitchOne.Execute(null);

            ICommand selectSignalCommand = switchOne.SelectSignalCommand;

            selectSignalCommand.Execute(null);

            selectSignalCommand = or.SelectSignalCommand;
            selectSignalCommand.Execute(or.InputSignals[0]);

            selectSignalCommand = or.SelectSignalCommand;
            selectSignalCommand.Execute(or.InputSignals[1]);

            selectSignalCommand = switchTwo.SelectSignalCommand;
            selectSignalCommand.Execute(null);

            Assert.AreEqual(true, or.OutputSignals[0].SignalValue);
        }
Exemplo n.º 2
0
        public void LogicalNotCommandTest()
        {
            SwitchVM      switchOne = new SwitchVM();
            LogicalBaseVM not       = LogicalBaseVM.CreateLogicalNot();

            ICommand selectSignalCommand = switchOne.SelectSignalCommand;

            selectSignalCommand.Execute(null);

            selectSignalCommand = not.SelectSignalCommand;
            selectSignalCommand.Execute(not.InputSignals[0]);

            Assert.AreEqual(true, not.OutputSignals[0].SignalValue);
        }
Exemplo n.º 3
0
        public void LogicalSpaceCommandTest()
        {
            SwitchVM      switchOne = new SwitchVM();
            LogicalBaseVM space     = LogicalBaseVM.CreateLogicalSpace();

            ICommand switchingSwitchOne = switchOne.SwitchingCommand;

            ICommand selectSignalCommand = switchOne.SelectSignalCommand;

            selectSignalCommand.Execute(null);

            selectSignalCommand = space.SelectSignalCommand;
            selectSignalCommand.Execute(space.InputSignals[0]);

            switchingSwitchOne.Execute(null);
            Assert.AreEqual(true, space.OutputSignals[0].SignalValue);
        }
Exemplo n.º 4
0
        public void SelectSignalValueTest()
        {
            SwitchVM      switchOne = new SwitchVM();
            SwitchVM      switchTwo = new SwitchVM();
            LogicalBaseVM and       = LogicalBaseVM.CreateLogicalAnd();

            ICommand switchingSwitchOne = switchOne.SwitchingCommand;

            switchingSwitchOne.Execute(null);

            ICommand switchingSwitchTwo = switchTwo.SwitchingCommand;

            switchingSwitchTwo.Execute(null);


            ICommand selectSignalCommand = switchOne.SelectSignalCommand;

            selectSignalCommand.Execute(null);
            Assert.AreEqual(switchOne.Output, SelectSignal.Signal);

            selectSignalCommand = switchTwo.SelectSignalCommand;
            selectSignalCommand.Execute(null);
            Assert.AreEqual(switchTwo.Output, SelectSignal.Signal);


            selectSignalCommand = and.SelectSignalCommand;
            selectSignalCommand.Execute(and.InputSignals[0]);
            Assert.AreEqual(null, SelectSignal.Signal);

            selectSignalCommand = and.SelectSignalCommand;
            selectSignalCommand.Execute(and.InputSignals[1]);
            Assert.AreEqual(and.InputSignals[1], SelectSignal.Signal);

            selectSignalCommand = switchOne.SelectSignalCommand;
            selectSignalCommand.Execute(null);
            Assert.AreEqual(null, SelectSignal.Signal);
        }
Exemplo n.º 5
0
        public void LogicalXorShemaCommandTest()
        {
            ObservableCollection <LogicalBase> xorInternalCollectionFrame =
                CreateCollectionFrame.CreateXorShemaFrame();

            LogicalBaseVM xor = LogicalBaseVM.CreateLogicalShema(xorInternalCollectionFrame);

            SwitchVM switchOne = new SwitchVM();
            SwitchVM switchTwo = new SwitchVM();

            ICommand switchingSwitchOne = switchOne.SwitchingCommand;

            switchingSwitchOne.Execute(null);

            ICommand switchingSwitchTwo = switchOne.SwitchingCommand;

            switchingSwitchOne.Execute(null);

            ICommand selectSignalCommand = switchOne.SelectSignalCommand;

            selectSignalCommand.Execute(null);

            selectSignalCommand = xor.SelectSignalCommand;
            selectSignalCommand.Execute(xor.InputSignals[0]);

            selectSignalCommand = xor.SelectSignalCommand;
            selectSignalCommand.Execute(xor.InputSignals[1]);

            selectSignalCommand = switchTwo.SelectSignalCommand;
            selectSignalCommand.Execute(null);

            Assert.AreEqual(false, xor.OutputSignals[0].SignalValue);

            switchingSwitchOne.Execute(null);
            Assert.AreEqual(true, xor.OutputSignals[0].SignalValue);
        }
Exemplo n.º 6
0
 public LogicalSpaceControl()
 {
     InitializeComponent();
     DataContext = LogicalBaseVM.CreateLogicalSpace();
 }
Exemplo n.º 7
0
 public LogicalOrControl(Int32 numberInputs = 2)
 {
     InitializeComponent();
     DataContext = LogicalBaseVM.CreateLogicalOr(numberInputs);
 }
Exemplo n.º 8
0
 public LogicalShemaControl(ObservableCollection <LogicalBaseVM> elements)
 {
     InitializeComponent();
     DataContext = LogicalBaseVM.CreateLogicalShema(elements);
 }