コード例 #1
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);
        }
コード例 #2
0
 public LogicalShemaControl(ObservableCollection <LogicalBaseVM> elements)
 {
     InitializeComponent();
     DataContext = LogicalBaseVM.CreateLogicalShema(elements);
 }