public void ShouldThrowPCalcLibErrorCodeExceptionIfNullContentFile() { using (var context = new PCalcProxyContext(m_Environment, null, null)) { Assert.Throws<PCalcLibErrorCodeException>(() => { var proxy = context.Proxy; }); } }
private void RunStart() { using (var context = new PCalcProxyContext(m_Environment, m_AmxFile.FullName, m_TableFile.FullName)) { Assert.That(context.Proxy, Is.Not.Null); IPCalcProxy proxy = context.Proxy; proxy.Start(m_Environment, m_Weight); } }
public void ShouldThrowPCalcLibErrorCodeExceptionIfContentFileDoesNotExist() { FileInfo amxFile = new FileInfo("Pt2097152.amx2"); FileInfo tableFile = new FileInfo("Pt2097152.bin2"); using (var context = new PCalcProxyContext(m_Environment, amxFile.FullName, tableFile.FullName)) { Assert.Throws<PCalcLibErrorCodeException>(() => { var proxy = context.Proxy; }); } }
public void ShouldThrowPCalcLibErrorCodeExceptionIfAmxFileLikeTableFile() { FileInfo amxFile = new FileInfo("Pt2097152.bin"); FileInfo tableFile = new FileInfo("Pt2097152.bin"); Assert.IsTrue(amxFile.Exists); Assert.IsTrue(tableFile.Exists); using (var context = new PCalcProxyContext(m_Environment, amxFile.FullName, tableFile.FullName)) { Assert.Throws<PCalcLibErrorCodeException>(() => { var proxy = context.Proxy; }); } }
public void ShouldCreateContextIfValidContentGiven() { FileInfo amxFile = new FileInfo("Pt2097152.amx"); FileInfo tableFile = new FileInfo("Pt2097152.bin"); Assert.IsTrue(amxFile.Exists); Assert.IsTrue(tableFile.Exists); using (var context = new PCalcProxyContext(m_Environment, amxFile.FullName, tableFile.FullName)) { Assert.IsNotNull(context.Proxy); } }
private void RunStart() { EnvironmentInfo environment = new EnvironmentInfo { Culture = "deDE", SenderZipCode = "121" }; WeightInfo weight = new WeightInfo { WeightUnit = EWeightUnit.TenthGram, WeightValue = 200 }; Assert.That(new FileInfo("Pt2097152.amx").Exists, Is.True); Assert.That(new FileInfo("Pt2097152.bin").Exists, Is.True); using (var context = new PCalcProxyContext(environment, new FileInfo("Pt2097152.amx").FullName, new FileInfo("Pt2097152.bin").FullName)) { Assert.That(context.Proxy, Is.Not.Null); IPCalcProxy proxy = context.Proxy; proxy.Start(environment, weight); } }
public ActionResult Index() { string pawnFile = HttpContext.Server.MapPath("~/App_Data/Pt2097152.amx"); string tableFile = HttpContext.Server.MapPath("~/App_Data/Pt2097152.bin"); EnvironmentInfo env = new EnvironmentInfo() { Culture = "de", SenderZipCode = "123" }; using (var context = new PCalcProxyContext(env, pawnFile, tableFile)) { IPCalcProxy proxy = context.Proxy; PCalcResultInfo result = null; result = proxy.Start(env, new WeightInfo() { WeightUnit = EWeightUnit.Gram, WeightValue = 20 }); result = proxy.Calculate(env, result.ProductDescription, new ActionResultInfo() { Action = EActionId.ShowMenu, Label = 0, Results = new List<AnyInfo> { new AnyInfo() { AnyType = EAnyType.INT32, AnyValue = "0" } } }); result = proxy.Calculate(env, result.ProductDescription, new ActionResultInfo() { Action = EActionId.ShowMenu, Label = 0, Results = new List<AnyInfo> { new AnyInfo() { AnyType = EAnyType.INT32, AnyValue = "0" } } }); } return View(); }
private static void Main(string[] args) { int iterations = 10000; for (int i = 0; i < iterations; i++) { using (PCalcProxyContext context = new PCalcProxyContext(ENVIRONMENT, AMX_FILE.FullName, TABLE_FILE.FullName)) { context.Proxy.Start(ENVIRONMENT, WEIGHT); } } using (PCalcProxyContext context = new PCalcProxyContext(ENVIRONMENT, AMX_FILE.FullName, TABLE_FILE.FullName)) { for (int i = 0; i < iterations; i++) { context.Proxy.Start(ENVIRONMENT, WEIGHT); } } }
private PCalcResultInfo Start(EnvironmentInfo info, WeightInfo weight) { using (var context = new PCalcProxyContext(info, m_AmxFile.FullName, m_TableFile.FullName)) { IPCalcProxy proxy = context.Proxy; Assert.That(proxy, Is.Not.Null); return proxy.Start(m_Environment, weight); } }
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 }; } }
private ScenarioResult<PCalcResultInfo> Start(EnvironmentInfo environment, WeightInfo weight, RateCalculationFileHandler handler) { using (var context = new PCalcProxyContext(environment, handler.PawnFile, handler.RateTableFile, handler.AdditionalFiles)) { IPCalcProxy proxy = context.Proxy; PCalcResultInfo result = proxy.Start(environment, weight); HandleCurrencySymbol(result, environment); return new ScenarioResult<PCalcResultInfo>() { Value = result }; } }