public async Task<PCalcResultInfo> Calculate(EnvironmentInfo environment, ProductDescriptionInfo productDescription, ActionResultInfo actionResult)
 {
     var result = new PCalcResultInfo();
     result.ProductDescription = productDescription;
     DescriptionInfo desc = GetRandomDescription();
     result.QueryType = GetQueryType(desc);
     result.QueryDescription = desc.ToTransferDescription();
     return result;
 }
        public void ShouldCalculateNextStep(int milliseconds)
        {
            m_ExpectedMaximum = TimeSpan.FromMilliseconds(milliseconds);

            ProductDescriptionInfo product = new ProductDescriptionInfo { ProductId = 1, WeightClass = 1, Weight = m_Weight };

            var actionResult = new ActionResultInfo { Action = EActionId.ShowMenu, Label = 0, Results = new List<AnyInfo> { new AnyInfo { AnyValue = "0", AnyType = EAnyType.UINT32 } } };
            PCalcResultInfo result = Calculate(m_Environment, product, actionResult);

            Assert.IsNotNull(result);
            Assert.AreEqual(EQueryType.ShowMenu, result.QueryType);
            Assert.Greater(result.ProductDescription.Weight.WeightValue, 0, "Product has no weight");

            Pass(result);
        }
 public async Task<PCalcResultInfo> UpdateWeight(EnvironmentInfo environment, ProductDescriptionInfo productDescription)
 {
     //lookup correct entry
     ScenarioResult initResult = await m_ScenarioRunner.RunAsync(InitFileHandler(environment));
     if (initResult.Success == false || m_Handler.IsValid == false)
     {
         return ReturnErrorResult(initResult);
     }
     ScenarioResult<PCalcResultInfo> updateWeightResult = m_ScenarioRunner.Run(() => UpdateWeight(environment, productDescription, m_Handler));
     if (updateWeightResult.Success == false)
     {
         return ReturnErrorResult(updateWeightResult);
     }
     return updateWeightResult.Value;
 }
 public async Task<PCalcResultInfo> Calculate(EnvironmentInfo environment, ProductDescriptionInfo productDescription, ActionResultInfo actionResult)
 {
     //lookup correct entry            
     ScenarioResult initResult = await m_ScenarioRunner.RunAsync(InitFileHandler(environment));
     if (initResult.Success == false || m_Handler.IsValid == false)
     {
         return ReturnErrorResult(initResult);
     }
     ScenarioResult<PCalcResultInfo> calcResult = m_ScenarioRunner.Run(() => Calculate(environment, productDescription, actionResult, m_Handler));
     if (calcResult.Success == false)
     {
         return ReturnErrorResult(calcResult);
     }
     return calcResult.Value;
 }
        private PCalcResultInfo Calculate(EnvironmentInfo info, ProductDescriptionInfo product, ActionResultInfo actionResult)
        {
            using (var context = new PCalcProxyContext(info, m_AmxFile.FullName, m_TableFile.FullName))
            {
                IPCalcProxy proxy = context.Proxy;
                Assert.That(proxy, Is.Not.Null);

                return proxy.Calculate(info, product, actionResult);
            }
        }
 private ScenarioResult<PCalcResultInfo> UpdateWeight(EnvironmentInfo environment, ProductDescriptionInfo description, RateCalculationFileHandler handler)
 {
     using (var context = new PCalcProxyContext(environment, handler.PawnFile, handler.RateTableFile, handler.AdditionalFiles))
     {
         IPCalcProxy proxy = context.Proxy;
         PCalcResultInfo result = proxy.Calculate(environment, description);
         HandleCurrencySymbol(result, environment);
         return new ScenarioResult<PCalcResultInfo>() { Value = result };
     }
 }
 public async Task<PCalcResultInfo> UpdateWeight(EnvironmentInfo environment, ProductDescriptionInfo productDescription)
 {
     throw new NotImplementedException();
 }