コード例 #1
0
ファイル: Variable.Steps.Tests.cs プロジェクト: drsslv/Molder
        public void CheckVariableEquals_VariableValueIsValid_ReturnTrue()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = "test"
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            steps.CheckVariableEquals("test", "test");
        }
コード例 #2
0
ファイル: Variable.Steps.Tests.cs プロジェクト: drsslv/Molder
        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).");
        }
コード例 #3
0
ファイル: Variable.Steps.Tests.cs プロジェクト: drsslv/Molder
        public void CheckVariableEquals_InCorrectExpected_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", null);

            act.Should().Throw <Exception>()
            .WithMessage($"Expected expected not to be <null> because значение \"expected\" не задано.");
        }
コード例 #4
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>()
            .Which.Message.Contains($"Значение переменной \"test\":\"test\" не равно \"mp\"");
        }
コード例 #5
0
        public void CheckVariableEquals_InCorrectType_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", 0);

            act.Should().Throw <Exception>()
            .Which.Message.Contains($"Тип значения переменной \"test\" не совпадает с типом \"0\"");
        }
コード例 #6
0
ファイル: Variable.Steps.Tests.cs プロジェクト: drsslv/Molder
        public void CheckVariablesAreEqual_InCorrectActual_ReturnException()
        {
            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);

            Action act = () => steps.CheckVariableEquals("test1", "{{test2}}");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected expected to be \"1\" because значение переменной \"test1\":\"1\" не равно \"2\", but \"2\" differs near \"2\" (index 0).");
        }
コード例 #7
0
ファイル: Variable.Steps.Tests.cs プロジェクト: drsslv/Molder
        public void CheckVariablesAreEqual_InCorrectValue1_ReturnException()
        {
            var variable = new Variable()
            {
                Type = typeof(string), Value = null
            };

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

            VariableSteps steps = new VariableSteps(variableController);

            Action act = () => steps.CheckVariableEquals("test1", "test2");

            act.Should().Throw <Exception>()
            .WithMessage($"Expected actual not to be <null> because значения в переменной \"test1\" нет.");
        }