예제 #1
0
        public void UserCanSetACostantValueViaString()
        {
            //Arrange
            string input = "a=15";
            Parse parse = new Parse();
            var constants = new Constants();
            char key = parse.ExtractConstant(input);
            int value = parse.ExtractValue(input);
            var splitInput = input.Split('=');

            //ACT
            constants.setConstant(key, value);

            //Assert
            Assert.IsTrue(constants.calculatorConstants.ContainsKey(key));
            Assert.IsTrue(constants.calculatorConstants.ContainsValue(value));
        }
예제 #2
0
        public void UserCanGetACostantValueViaString()
        {
            //Arrange
            string input = "a=15";
            Parse parse = new Parse();
            var constants = new Constants();
            Char key = parse.ExtractConstant(input);
            int value = parse.ExtractConstant(input);
            var splitInput = input.Split('=');
            constants.setConstant(key, value);

            //ACT
            int valueExtracted = constants.getConstant(key);

            //Assert
            Assert.AreEqual(value, valueExtracted);
        }