public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); List <KeyValuePair <CurrencyStatus?, string> > statusList = EnumConverter.GetKeyValuePairs <CurrencyStatus>(); statusList.Insert(0, new KeyValuePair <CurrencyStatus?, string>(null, ResCommonEnum.Enum_Select)); lisStatus.ItemsSource = statusList; List <KeyValuePair <bool?, string> > isLocalList = new List <KeyValuePair <bool?, string> >(); isLocalList.Insert(0, new KeyValuePair <bool?, string>(true, "是")); isLocalList.Insert(1, new KeyValuePair <bool?, string>(false, "否")); lisIsLocal.ItemsSource = isLocalList; _currencyInfoVm = new CurrencyInfoVM(); _currencyFacade = new CurrencyFacade(this); Currency_Feild.DataContext = _currencyInfoVm; if (this.Request.QueryString.ContainsKey("operation")) { _op = this.Request.QueryString["operation"]; } if (this.Request.QueryString.ContainsKey("sysno")) { _sysNo = int.Parse(this.Request.QueryString["sysno"]); _currencyFacade.Load(_sysNo, (s, args) => { _currencyInfoVm = args.Result; Currency_Feild.DataContext = _currencyInfoVm; }); } }
public async Task CalculateProductPrices_Returns_Product_Prices_In_Currency() { string currencyCode = "EUR"; decimal exchangeRate = 1.11m; int pageStart = 0; int pageSize = 5; string[] sampleProducts = new[] { "Sausage Roll", "Vegan Sausage Roll", "Steak Bake", "Yum Yum", "Pink Jammie" }; var rng = new Random(); var productList = Enumerable.Range(1, pageSize).Select(index => new Product { PriceInPounds = rng.Next(0, 10), Name = sampleProducts[rng.Next(sampleProducts.Length)] }) .ToArray(); var sut = new CurrencyFacade(); var products = sut.CalculateProductPrices(productList, currencyCode); products.Should().BeOfType <Product[]>(); products.FirstOrDefault().Currency.Should().Be(currencyCode); products.FirstOrDefault().Price.Should().Be(products.FirstOrDefault().PriceInPounds *exchangeRate); }
public CurrencyController(CurrencyFacade currencyFacade) { CurrencyFacade = currencyFacade; }
public override void OnPageLoad(object sender, EventArgs e) { base.OnPageLoad(sender, e); _facade = new CurrencyFacade(this); QueryResult.Bind(); }
public CurrencyController(CurrencyFacade facade) { _facade = facade; }