public void StoreAsVariableStringFormat_IncorrectVariableName_ReturnException()
        {
            // Act
            VariableSteps steps = new VariableSteps(variableController);

            // Arrange
            Action act = () => steps.StoreAsVariableStringFormat("test", "text", "test2");

            // Assert
            act
            .Should().Throw <Exception>()
            .Which.Message.Contains("переменная \"test\" не существует");
        }
示例#2
0
        public void StoreAsVariableStringFormat_VariableValueIsValid_ReturnTrue(string text, object value, string res)
        {
            // Act
            var variable = new Variable()
            {
                Type = value.GetType(), Value = value
            };

            variableController.Variables.TryAdd("test", variable);

            VariableSteps steps = new VariableSteps(variableController);

            // Arrange
            steps.StoreAsVariableStringFormat("test", text, "test2");

            var expected = variableController.Variables["test2"].Value;

            expected.Should().Be(res);
        }
        public void StoreAsVariableStringFormat_IncorrectNewVariableName_ReturnException()
        {
            // Act
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

            variableController.Variables.TryAdd("test", variable);
            variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };
            variableController.Variables.TryAdd("test2", variable);
            VariableSteps steps = new VariableSteps(variableController);

            // Arrange
            Action act = () => steps.StoreAsVariableStringFormat("test", "text", "test2");

            // Assert
            act
            .Should().Throw <Exception>()
            .Which.Message.Contains("переменная \"test2\" уже существует");
        }