String UI for writing to a string variable.
Inheritance: IUI, INotifyPropertyChanged
 // Functions
 /// <summary>
 /// Default constructor setting up simulator.
 /// 
 /// Note: Edits Factory->Simulator.
 /// </summary>
 public SimulatorViewModel()
 {
     //_sim = Factory.currentIRobotInstance;
     suiSimulatorUI = new StringUI();
     Factory.getSimulatorInstance.IUIOutput = suiSimulatorUI;
     _sim = Factory.getSimulatorInstance;
 }
Example #2
0
        public void StringUI_WriteLine_BufferAreSame()
        {
            StringUI _stringUI = new StringUI();
            object[] Array = new[] { "1", "2" };

            _stringUI.writeLine("Hello {0}", Array);
            _stringUI.writeLine("Hello {1}", Array);

            Assert.AreEqual("* Hello 1\r\n* Hello 2\r\n", _stringUI.Buffer);
        }
Example #3
0
        public void StringUI_WriteLine_ThenClear_BufferIsEmpty()
        {
            StringUI _stringUI = new StringUI();

            object[] Array = new[] { "1", "2" };

            _stringUI.writeLine("Hello {0}", Array);
            _stringUI.writeLine("Hello {1}", Array);

            _stringUI.clearString();

            Assert.IsEmpty(_stringUI.Buffer);
        }
Example #4
0
        public void StringUI_ProportyChanged()
        {
            StringUI _stringUI = new StringUI();

            PropertyChangedEventHandler _propertyChanged = (sender, e) => Assert.AreEqual("Buffer", e.PropertyName);

            _stringUI.PropertyChanged += _propertyChanged;

            object[] Array = new[] { "1", "2" };

            _stringUI.writeLine("Hello {0}", Array);

            Assert.AreEqual("* Hello 1\r\n", _stringUI.Buffer);
        }
Example #5
0
 public void StringUI_Constructor_Test()
 {
     StringUI _stringUI = new StringUI();
     Assert.IsEmpty(_stringUI.Buffer);
 }