public void ensureSetInputValueSucceeds() { AlgorithmImpl alg = new AlgorithmImpl(); alg.setInputValue(Input.valueOf("one", "range"), "1"); Assert.Equal("1", alg.inputValues[0].value); }
public void ensureSetInputValuesFailsIfArgumentIsNull() { AlgorithmImpl alg = new AlgorithmImpl(); Action action = () => alg.setInputValues(null); Assert.Throws <ArgumentNullException>(action); }
public void ensureSetInputValueFailsIfInputDoesNotExist() { AlgorithmImpl alg = new AlgorithmImpl(); Action action = () => alg.setInputValue(Input.valueOf("three", "range"), "val"); Assert.Throws <ArgumentException>(action); }
public void ensureSetInputValueFailsIfInputExistsButDoesNotSupportValue() { AlgorithmImpl alg = new AlgorithmImpl(); Action action = () => alg.setInputValue(Input.valueOf("one", "range"), "2"); Assert.Throws <ArgumentOutOfRangeException>(action); }
public void ensureReadyFails() { AlgorithmImpl alg = new AlgorithmImpl(); alg.setInputValue(Input.valueOf("one", "range"), "1"); Action action = () => alg.ready(); Assert.Throws <ArgumentNullException>(action); }
public void ensureGetRequiredInputsSucceeds() { AlgorithmImpl alg = new AlgorithmImpl(); List <Input> inputs = alg.getRequiredInputs(); Assert.Equal(2, inputs.Count); Assert.Equal("one", inputs[0].name); Assert.Equal("two", inputs[1].name); }
public void ensureReadySucceeds() { Input input1 = Input.valueOf("one", "number 1"); Input input2 = Input.valueOf("two", "number 2"); AlgorithmImpl alg = new AlgorithmImpl(); Dictionary <Input, string> inputValues = new Dictionary <Input, string>(); inputValues.Add(input1, "1"); inputValues.Add(input2, "2"); alg.setInputValues(inputValues); alg.ready(); //this method does not need an assert }
public void ensureSetInputValuesSucceeds() { Input input1 = Input.valueOf("one", "number 1"); Input input2 = Input.valueOf("two", "number 2"); AlgorithmImpl alg = new AlgorithmImpl(); Dictionary <Input, string> inputValues = new Dictionary <Input, string>(); inputValues.Add(input1, "1"); inputValues.Add(input2, "2"); alg.setInputValues(inputValues); Assert.Equal("1", alg.inputValues[0].value); Assert.Equal("2", alg.inputValues[1].value); }
public void ensureSetInputValuesFailsIfAtLeastOneInputIsInvalid() { Input input1 = Input.valueOf("one", "number 1"); Input input2 = Input.valueOf("three", "number 3"); AlgorithmImpl alg = new AlgorithmImpl(); Dictionary <Input, string> inputValues = new Dictionary <Input, string>(); inputValues.Add(input1, "1"); inputValues.Add(input2, "3"); Action action = () => alg.setInputValues(inputValues); Assert.Throws <ArgumentException>(action); }