private bool InputCompare(ServiceTestModel other, bool inputCompare) { if (_inputs == null) { return(true); } if (_inputs.Count != other._inputs.Count) { return(false); } for (int i = 0; i < _inputs.Count; i++) { if (Inputs[i].Value != other.Inputs[i].Value) { inputCompare = false; } if (!inputCompare) { continue; } if (Inputs[i].Variable != other.Inputs[i].Variable) { inputCompare = false; } if (!inputCompare) { continue; } if (Inputs[i].EmptyIsNull != other.Inputs[i].EmptyIsNull) { inputCompare = false; } } return(inputCompare); }
bool OutputCompare(ServiceTestModel other) { if (_outputs == null) { return(true); } if (_outputs.Count != other._outputs.Count) { return(false); } var outputCompare = true; for (int i = 0; i < _outputs.Count; i++) { outputCompare &= _outputs[i].Value == other._outputs[i].Value; outputCompare &= _outputs[i].Variable == other._outputs[i].Variable; outputCompare &= _outputs[i].AssertOp == other._outputs[i].AssertOp; outputCompare &= _outputs[i].From == other._outputs[i].From; outputCompare &= _outputs[i].To == other._outputs[i].To; if (!outputCompare) { return(outputCompare); } } return(outputCompare); }
private bool EqualsSeq(ServiceTestModel other) { return(string.Equals(_testName, other._testName) && string.Equals(_userName, other._userName) && string.Equals(_password, other._password) && _noErrorExpected == other._noErrorExpected && _errorExpected == other._errorExpected && _errorContainsText == other._errorContainsText && _enabled == other._enabled && _authenticationType == other._authenticationType); }
private bool TestStepCompare(ServiceTestModel other, bool stepCompare) { if (_testSteps == null) { return(true); } if (_testSteps.Count != other._testSteps.Count) { return(false); } for (int i = 0; i < _testSteps.Count; i++) { if (TestSteps[i].Type != other.TestSteps[i].Type) { stepCompare = false; } if (!stepCompare) { continue; } if (TestSteps[i].StepOutputs.Count != other.TestSteps[i].StepOutputs.Count) { stepCompare = false; } if (!stepCompare) { continue; } if (TestSteps[i].Children.Count != other.TestSteps[i].Children.Count) { stepCompare = false; } if (!stepCompare) { continue; } if (TestSteps[i].Children.Count > 0) { var stepChildren = TestSteps[i].Children; var otherStepChildren = other.TestSteps[i].Children; stepCompare = StepChildrenCompare(stepChildren, otherStepChildren); } if (!stepCompare) { continue; } var stepOutputs = TestSteps[i].StepOutputs; var otherStepOutputs = other.TestSteps[i].StepOutputs; stepCompare = StepOutputsCompare(stepOutputs, otherStepOutputs); } return(stepCompare); }
private bool OutputCompare(ServiceTestModel other, bool outputCompare) { if (_outputs == null) { return(true); } if (_outputs.Count != other._outputs.Count) { return(false); } for (int i = 0; i < _outputs.Count; i++) { if (_outputs[i].Value != other._outputs[i].Value) { outputCompare = false; } if (!outputCompare) { continue; } if (_outputs[i].Variable != other._outputs[i].Variable) { outputCompare = false; } if (!outputCompare) { continue; } if (_outputs[i].AssertOp != other._outputs[i].AssertOp) { outputCompare = false; } if (!outputCompare) { continue; } if (_outputs[i].From != other._outputs[i].From) { outputCompare = false; } if (!outputCompare) { continue; } if (_outputs[i].To != other._outputs[i].To) { outputCompare = false; } } return(outputCompare); }
bool EqualsSeq(ServiceTestModel other) { var equalsSeq = string.Equals(_testName, other._testName); equalsSeq &= string.Equals(_userName, other._userName); equalsSeq &= string.Equals(_password, other._password); equalsSeq &= _noErrorExpected == other._noErrorExpected; equalsSeq &= _errorExpected == other._errorExpected; equalsSeq &= _errorContainsText == other._errorContainsText; equalsSeq &= _enabled == other._enabled; equalsSeq &= _authenticationType == other._authenticationType; return(equalsSeq); }
bool Equals(ServiceTestModel other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var equalsSeq = EqualsSeq(other); var inputCompare = InputCompare(other); var outputCompare = OutputCompare(other); var testStepCompare = TestStepCompare(other); var @equals = equalsSeq && inputCompare && testStepCompare && outputCompare; return(@equals); }
public IServiceTestModel CreateTest(IResourceModel resourceModel, int testNumber, bool isFromDebug) { var testModel = new ServiceTestModel(resourceModel.ID) { TestName = "Test " + (testNumber == 0 ? 1 : testNumber), TestPending = true, Enabled = true, NewTest = true, NoErrorExpected = true, ErrorExpected = false, ErrorContainsText = string.Empty, Inputs = new ObservableCollection <IServiceTestInput>(), Outputs = new ObservableCollection <IServiceTestOutput>(), }; if (!string.IsNullOrEmpty(resourceModel.DataList)) { DataList = new DataListModel(); DataList.Create(resourceModel.DataList, resourceModel.DataList); var inputList = _dataListConversionUtils.GetInputs(DataList); var outputList = _dataListConversionUtils.GetOutputs(DataList); testModel.Inputs = inputList.Select(sca => { var serviceTestInput = new ServiceTestInput(sca.DisplayValue, ""); serviceTestInput.AddNewAction = () => testModel.AddRow(serviceTestInput, DataList); return((IServiceTestInput)serviceTestInput); }).ToObservableCollection(); if (!isFromDebug) { testModel.Outputs = outputList.Select(sca => { var serviceTestOutput = new ServiceTestOutput(sca.DisplayValue, "", "", ""); serviceTestOutput.AddNewAction = () => testModel.AddRow(serviceTestOutput, DataList); return((IServiceTestOutput)serviceTestOutput); }).ToObservableCollection(); } } testModel.Item = (ServiceTestModel)testModel.Clone(); return(testModel); }
bool InputCompare(ServiceTestModel other) { if (_inputs == null) { return(true); } if (_inputs.Count != other._inputs.Count) { return(false); } var inputCompare = true; for (int i = 0; i < _inputs.Count; i++) { inputCompare &= Inputs[i].Value == other.Inputs[i].Value; inputCompare &= Inputs[i].Variable == other.Inputs[i].Variable; inputCompare &= Inputs[i].EmptyIsNull == other.Inputs[i].EmptyIsNull; if (!inputCompare) { return(inputCompare); } } return(inputCompare); }