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"); }
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 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\" не задано."); }
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\""); }
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\""); }
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)."); }
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\" нет."); }