Exemple #1
0
        public void ShouldNot_Clone_Constants()
        {
            var original = new ConstantObject();
            var cloned   = original.Clone();

            Assert.IsNotNull(cloned);
        }
        public void ToString_WhenCalledAndIsNull_CorrectStringIsSet()
        {
            //Arrange
            double?newValue       = null;
            var    constantObject = new ConstantObject(newValue);

            //Act
            var result = constantObject.ToString();

            //Assert
            Assert.AreEqual(result, "constant");
        }
        public void ToString_WhenCalledAndHasValue_CorrectStringIsSet()
        {
            //Arrange
            const double newValue       = 12;
            var          constantObject = new ConstantObject(newValue);

            //Act
            var result = constantObject.ToString();

            //Assert
            Assert.AreEqual(result, newValue.ToString(CultureInfo.InvariantCulture));
        }
        public void Constructor_WhenCalledWithNull_ValueIsSet()
        {
            //Arrange
            double?newValue = null;

            //Act
            var constantObject = new ConstantObject(newValue);

            //Assert
            Assert.AreEqual(newValue, constantObject.Value);
            Assert.AreEqual(GraphObjectType.Constant, constantObject.GraphObjectType);
        }
        public void Constructor_WhenCalled_ValueIsSet()
        {
            //Arrange
            const int newValue = 12;

            //Act
            var constantObject = new ConstantObject(newValue);

            //Assert
            Assert.AreEqual(newValue, constantObject.Value);
            Assert.AreEqual(GraphObjectType.Constant, constantObject.GraphObjectType);
        }
Exemple #6
0
    // Start is called before the first frame update
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
    }
Exemple #7
0
        public void HandleSelectionChangedOnVariable(object sender,
                                                     SelectionChangedEventArgs selectionChangedEventArgs)
        {
            if (((ComboBox)sender).SelectedItem is ConstantObject)
            {
                var result = new InputBox().ShowAndWaitForResult();
                var item   = new ConstantObject(result);

                PlotterViewModel.AddComponent(item);

                _validator.DoTransition(item);

                CompositeFunction.Text = PlotterViewModel.GetCompositeFunction();

                return;
            }

            HandleSelectionChanged(sender, selectionChangedEventArgs);
        }
        public void EnableValidTransitions_WhenCalledWithConstant_CorrectStatesAreEnabled()
        {
            //Arrange
            var uiElements = GetTestComboBox();
            var nextState  = new ConstantObject(12);
            var automaton  = new FiniteStateAutomatonValidator(uiElements);

            //Act
            automaton.DoTransition(nextState);
            var result = automaton.GetUiElements();

            //Assert

            Assert.IsTrue(result[0].IsEnabled == false);
            Assert.IsTrue(result[2].IsEnabled == false);
            Assert.IsTrue(result[3].IsEnabled); //op
            Assert.IsTrue(result[1].IsEnabled); //leftBracket
            Assert.IsTrue(result[4].IsEnabled == false);
        }