Exemplo n.º 1
0
        public async Task <List <UnitConverterResults> > GetActionNamesAndOutputsViaHTTP(List <double> texts, List <string> actions)
        {
            var actual = new List <UnitConverterResults>();

            foreach (var input in texts)
            {
                var tempActual = new UnitConverterResults {
                    input = double.Parse(input.ToString())
                };

                foreach (var action in actions)
                {
                    tempActual.action = action;

                    var response = SubmitForm(input.ToString(), action);
                    response.Wait();

                    var tempOutput = await GetResponseAsTaskAsync(response.Result);

                    tempActual.output = double.Parse(tempOutput);

                    actual.Add(tempActual);
                }
            }
            return(actual);
        }
        private void InitializeExpectedValues()
        {
            var ToBeAdded = new UnitConverterResults();

            for (var x = 0; x < texts.Count; x++)
            {
                for (var y = 0; y < actions.Count; y++)
                {
                    var OutputsForThisAction = BackEndHelperFunctions.CheckActions(actions[y], KeywordMap);

                    ToBeAdded.input  = texts[x];
                    ToBeAdded.action = actions[y];
                    ToBeAdded.output = OutputsForThisAction[x];

                    expected.Add(ToBeAdded);
                }
            }
        }
 public static UnitConverterResults FindActualResultForExpectation(UnitConverterResults expectation, List <UnitConverterResults> listOfActualResults)
 {
     return(listOfActualResults.Single(result => result.action == expectation.action && result.input.ApproximatelyEquals(expectation.input)));
 }