public static void ShowMe(int id, BuyHandler bCallback = null, CancelHandler cCallback = null) { itemId_ = id; buyCallback_ = bCallback; cancelCallback_ = cCallback; UIBase.AsyncLoad(UIASSETS_ID.UIASSETS_QuickBuyPanel); }
public static void SwithShowMe(int id, BuyHandler bCallback = null, CancelHandler cCallback = null) { itemId_ = id; buyCallback_ = bCallback; cancelCallback_ = cCallback; UIBase.SwitchShowPanelByName(UIASSETS_ID.UIASSETS_QuickBuyPanel); }
protected override void Awake() { base.Awake(); WS = GameObject.Find("Store").GetComponent <websockets>(); articleUI = GameObject.Find("ArticleUI").GetComponent <ArticleUI>(); cart = GameObject.Find("ArticleUI/Canvas/AddToCartBtn/AddToCart").GetComponent <cartHandler>(); buyHandler = GameObject.Find("Store/Checkout/CheckoutCanvas/Buy").GetComponent <BuyHandler>(); dot = m_Camera.GetComponentInChildren <Image>(); m_Data = new PointerEventData(eventSystem); }
private void Awake() { qtInCart = 0; cartPrice = "0"; hintState = "ENDED"; spawners = GameObject.FindGameObjectsWithTag("Spawner"); articles = GameObject.FindGameObjectsWithTag("Article"); balloon = GameObject.FindGameObjectWithTag("Balloon").GetComponent <AVRSays>(); happyFace = GameObject.FindGameObjectWithTag("HappyFace"); happyFace.SetActive(false); fader = GameObject.FindGameObjectWithTag("Fader").GetComponent <UIFader>(); cashier = GameObject.Find("Store/Checkout/Cashier"); buyH = GameObject.Find("Store/Checkout/CheckoutCanvas/Buy").GetComponent <BuyHandler>(); Connect(); }
public async Task ShouldBuyOffers_PriceEqualOrLess() { // arrange var configuration = Mock.Of <IConfiguration>(); Mock.Get(configuration).SetupGet(x => x.StockExchangeUrl).Returns("https://moex.ru/api"); var stockExchange = Mock.Of <IStockExchangeApiService>(); Mock.Get(stockExchange).Setup(x => x.ConnectAsync(It.IsAny <string>())).Returns(Task.CompletedTask); var offers = new List <Offer> { new() { Id = 1, Type = OfferType.Sell, Count = 20, Price = 120 }, new() { Id = 2, Type = OfferType.Sell, Count = 10, Price = 110 }, new() { Id = 3, Type = OfferType.Sell, Count = 5, Price = 100 }, new() { Id = 4, Type = OfferType.Buy, Count = 5, Price = 90 }, new() { Id = 5, Type = OfferType.Buy, Count = 10, Price = 80 }, new() { Id = 6, Type = OfferType.Buy, Count = 20, Price = 70 } }; Mock.Get(stockExchange).Setup(x => x.GetOffersAsync()) .ReturnsAsync(offers); Mock.Get(stockExchange).Setup(x => x.BuyAsync(It.IsAny <int>(), It.IsAny <int>())) .ReturnsAsync((int offerId, int countToBuy) => { var offer = offers.Single(x => x.Id == offerId); return(offer.Count > countToBuy ? countToBuy : offer.Count); }); var handler = new BuyHandler(configuration, stockExchange); // act var boughtCount = await handler.Handle(new BuyCommand { Price = 115, Count = 20 }); // assert Assert.Equal(15, boughtCount); Mock.Get(stockExchange).Verify(x => x.ConnectAsync(configuration.StockExchangeUrl), Times.Once); Mock.Get(stockExchange).Verify(x => x.BuyAsync(3, 20), Times.Once); Mock.Get(stockExchange).Verify(x => x.BuyAsync(2, 15), Times.Once); Mock.Get(stockExchange).Verify(x => x.BuyAsync(1, It.IsAny <int>()), Times.Never); } }
/// <summary> /// valid md5 code = "9c5d111bcd4e16dda8661aae0d008485" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void referralCodeClick_Click(object sender, EventArgs e) { if (this.IsPostBack) { IsPaymentVisible.Text = "1"; InvalidReferralCodeError.Visible = true; string referralCode = referralcodeId.Text; if (!string.IsNullOrEmpty(referralCode)) { if (ReferralCore.IsPaidMd5Code(referralCode)) { BuyString = BuyHandler.GetBuyBlurb(Context, "3.00 - 0.15 (5% referral discount) = 2.85", true, referralCode); InvalidReferralCodeError.Visible = false; } } } }
protected void Page_Load(object sender, EventArgs e) { BuyString = BuyHandler.GetBuyBlurb(Context); }
protected void Page_Load(object sender, EventArgs e) { BuyString = BuyHandler.GetBuyBlurb(Context, "3.00", false, string.Empty); //this.InvalidReferralCodeError = false; }