public void EmtpyVariable_CorrectVariable_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.EmtpyVariable("test");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"переменная \"test\" не существует");
        }
        public void StoreAsVariableXmlFromText_IncorrectXml_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.StoreAsVariableXmlFromText("test", "test");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Создать XmlDoc из строки \"test\" не удалось.");
        }
Beispiel #3
0
        public void StoreAsVariableNumber_IncorrectVariable_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.StoreAsVariableNumber("test", "test");

            act.Should().Throw <Exception>()
            .WithMessage($"Input string was not in a correct format.");
        }
        public void StoreVariableValueToVariable_CorrectSecondVariable_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.StoreVariableValueToVariable("test", null);

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"переменная \"test\" не существует");
        }
Beispiel #5
0
        public void EmtpyVariable_CorrectVariable_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.EmtpyVariable("test");

            act.Should().Throw <Exception>()
            .WithMessage("Expected this.variableController.Variables {empty} to contain key \"test\" because переменная \"test\" не существует.");
        }
Beispiel #6
0
        public void StoreAsVariableXmlFromText_IncorrectXml_ReturnException()
        {
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.StoreAsVariableXmlFromText("test", "test");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected doc not to be <null> because создать XmlDoc из строки \"test\" не удалось.");
        }
Beispiel #7
0
        public void StoreAsVariableXmlFromText_CorrectXml_ReturnXmlDoc(string xml)
        {
            VariableSteps steps = new VariableSteps(variableController);

            steps.StoreAsVariableXmlFromText("test", xml);
            var variableCheck = variableController.GetVariable("test");

            variableCheck.Type.Should().Be(typeof(XmlDocument));
            variableCheck.Value.Should().NotBeNull();
        }
Beispiel #8
0
        public void StoreAsVariableText_ValidValue_ReturnNewVariable()
        {
            VariableSteps steps = new VariableSteps(variableController);

            steps.StoreAsVariableText("test", "test");

            var variableCheck = variableController.GetVariable("test");

            variableCheck.Type.Should().Be(typeof(string));
            variableCheck.Value.Should().Be("test");
        }
Beispiel #9
0
        public void StoreAsVariableEncriptedString_ValidValue_ReturnNewVariable()
        {
            VariableSteps steps = new VariableSteps(variableController);
            var           str   = Encryptor.Encrypt("test");

            steps.StoreAsVariableEncriptedString(str, "test");

            var variableCheck = variableController.GetVariable("test");

            variableCheck.Type.Should().Be(typeof(string));
            variableCheck.Value.Should().Be("test");
        }
        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\" не существует");
        }
Beispiel #11
0
        public void CheckVariableEndsWith_VariableValueIsValid_ReturnTrue()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            steps.CheckVariableEndsWith("test", "test");
        }
Beispiel #12
0
        public void CheckVariableIsEmpty_CorrectVarName_ReturnTrue()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            steps.CheckVariableIsEmpty("test");
        }
        public void CheckVariableNotEquals_InCorrectType_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableNotEquals("test", 0);

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Тип значения переменной \"test\" не совпадает с типом \"0\"");
        }
        public void CheckVariableStartsWith_InCorrectExpected_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableStartsWith("test", null);

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Значение \"expected\" не задано.");
        }
Beispiel #15
0
        public void CheckVariableEquals_InCorrectEquals_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEquals("test", "mp");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected expected to be \"test\" with a length of 4 because значение переменной \"test\":\"test\" не равно \"mp\", but \"mp\" has a length of 2, differs near \"mp\" (index 0).");
        }
        public void CheckVariableEndsWith_InCorrectActual_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = null
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEndsWith("test", "123");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Значение переменной \"test\" NULL.");
        }
Beispiel #17
0
        public void CheckVariableEndsWith_InCorrectEquals_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEndsWith("test", "123");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected actual \"test\" to end with \"123\" because значение переменной \"test\":\"test\" не заканчивается с \"123\".");
        }
Beispiel #18
0
        public void CheckVariableEndsWith_InCorrectExpected_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEndsWith("test", null);

            act.Should().Throw <Exception>()
            .WithMessage($"Expected expected not to be <null> because значение \"expected\" не задано.");
        }
Beispiel #19
0
        public void CheckVariableEndsWith_InCorrectActual_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = null
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEndsWith("test", "123");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected actual not to be <null> because значения в переменной \"test\" нет.");
        }
Beispiel #20
0
        public void CheckVariableNotContains_InCorrectEquals_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableNotContains("test", "test");

            act.Should().Throw <Exception>()
            .WithMessage($"Did not expect actual \"test\" to contain \"test\" because значение переменной \"test\":\"test\" содержит \"test\".");
        }
Beispiel #21
0
        public void CheckVariableStartsWith_InCorrectEquals_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableStartsWith("test", "mp");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected actual to start with \"mp\" because значение переменной \"test\":\"test\" не начинается с \"mp\", but \"test\" differs near \"tes\" (index 0).");
        }
        public void CheckVariableStartsWith_InCorrectEquals_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

            variableController.Variables.TryAdd("test", variable);
            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableStartsWith("test", "mp");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Значение переменной \"test\":\"test\" не начинается с \"mp\"");
        }
        public void StoreVariableValueToVariable_CorrectFirstVariable_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.StoreVariableValueToVariable("test", "test");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Переменная \"test\" уже существует");
        }
        public void CheckVariableIsEmpty_VariableValueIsEmpty_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableIsEmpty("test");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Значение переменной \"test\" не пустая строка");
        }
Beispiel #25
0
        public void CheckVariableIsEmpty_VariableValueIsEmpty_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableIsEmpty("test");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected string.IsNullOrWhiteSpace((string)value) to be true because значение переменной \"test\" не пустая строка, but found False.");
        }
        public void CheckVariableIsNotNull_VariableValueIsNull_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = null
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableIsNotNull("test");

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Значение переменной \"test\" является NULL");
        }
Beispiel #27
0
        public void CheckVariableIsNull_VariableValueIsNull_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableIsNull("test");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected value to be <null> because значение переменной \"test\" не является NULL, but found \"\".");
        }
Beispiel #28
0
        public void DeleteVariable_CorrectVariable_ReturnFalse()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            steps.DeleteVariable("test");

            var check = variableController.CheckVariableByKey("test");

            check.Should().BeFalse();
        }
Beispiel #29
0
        public void CheckVariableAreNotContains_VariableValueIsValid_ReturnTrue()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "1"
            };

            variableController.Variables.TryAdd("test1", variable);
            variable = new Variable()
            {
                Type = typeof(string), Value = "2"
            };
            variableController.Variables.TryAdd("test2", variable);

            VariableSteps steps = new VariableSteps(variableController);

            steps.CheckVariableNotContains("test1", "{test2}");
        }
Beispiel #30
0
        public void ChangeVariable_IntValue_ReturnNewVariable()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = string.Empty
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            steps.ChangeVariable("test", 0);

            var variableCheck = variableController.GetVariable("test");

            variableCheck.Type.Should().Be(typeof(int));
            variableCheck.Value.Should().Be(0);
        }