public void TestLogic() { ShopLogic shopLogic = new ShopLogic(); DataGeneration datagen = new DataGeneration(); shopLogic.ParseData(datagen.GiveData()); Assert.IsTrue(shopLogic.IsInStock("Chocolate")); Assert.IsTrue(shopLogic.IsInStock("Bun")); Assert.IsTrue(shopLogic.IsInStock("Cheese")); Assert.IsTrue(shopLogic.IsInCatalog("Eggs")); Assert.IsTrue(shopLogic.IsInCatalog("Water")); Assert.IsTrue(shopLogic.IsInCatalog("Milk")); Assert.IsTrue(shopLogic.IsInShop("Mark")); Assert.IsTrue(shopLogic.IsInShop("Cody")); Assert.IsTrue(shopLogic.IsInShop("Anna")); shopLogic.AddToBasket(shopLogic.shop.Clients[1], shopLogic.shop.Stock[0]); shopLogic.AddToBasket(shopLogic.shop.Clients[1], shopLogic.shop.Stock[4]); Assert.IsTrue(shopLogic.ValueOfBasket(shopLogic.shop.Clients[1]) == 5.20); Assert.IsFalse(shopLogic.Checkout(shopLogic.shop.Clients[1])); shopLogic.RemoveFromBasket(shopLogic.shop.Clients[1], shopLogic.shop.Clients[1].Basket[1]); shopLogic.AddToBasket(shopLogic.shop.Clients[1], shopLogic.shop.Stock[1]); Assert.IsTrue(shopLogic.Checkout(shopLogic.shop.Clients[1])); Assert.IsTrue(shopLogic.IsInStock("Ice Cream")); Assert.IsFalse(shopLogic.IsInStock("Water")); }
public void UpdateShop() { var mock = new Mock <IShopDao>(); mock.Setup(item => item.GetShopById(It.Is <int>(v => v == 1))).Returns( new Shop { IDShop = 1, NameShop = "Lime", Address = "Зарубина", DescriptionShop = "Кафе", Website = "lime.ru", Rating = 0, PhoneShop = "+7909323232", City = "Saratov", OpeningHours = "9:00-21:00" }); var logic = new ShopLogic(mock.Object); mock.Setup(item => item.Update(It.IsAny <Shop>())); Assert.AreEqual(true, logic.Update( new Shop { IDShop = 1, NameShop = "Lime", Address = "Зарубина", DescriptionShop = "Кафе", Website = "lime.ru", Rating = 0, PhoneShop = "+7909323232", City = "Moscow", OpeningHours = "9:00-21:00" }), "Method Update doesn't work"); }
/// <summary> /// This is the order eraser menu method. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void DeleteEquipment(ShopLogic shopLogic) { int id = IntParse(Enter.ToString()); bool valid = false; try { shopLogic?.GetSkiEquipmentsById(id); valid = true; } catch (ArgumentException) { Console.WriteLine(Other.ToString()); } if (valid) { bool exists = shopLogic.DeleteEquipment(id); if (exists) { string print = "Entity deleted."; Console.WriteLine(print.ToString()); } else { Console.WriteLine(Other.ToString()); id = IntParse(Enter.ToString()); } } Console.ReadLine(); }
/// <summary> /// This lists the price changing method. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void ChangePrice(ShopLogic shopLogic) { int id = IntParse(Enter.ToString()); bool valid = false; try { shopLogic?.GetSkiEquipmentsById(id); valid = true; } catch (ArgumentException) { Console.WriteLine(Other.ToString()); } if (valid) { Console.WriteLine(Selected.ToString()); Console.WriteLine(shopLogic?.GetSkiEquipmentsById(id).ToString()); const string Np = "Enter new price here: "; int price = IntParse(Np.ToString()); shopLogic?.ChangePrice(id, price); Console.WriteLine(Saved.ToString()); } Console.ReadLine(); }
/// <summary> /// This method lists one of the Ski equipments. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void GetOneEquipment(ShopLogic shopLogic) { int id = IntParse(Enter.ToString()); bool valid = false; try { shopLogic?.GetSkiEquipmentsById(id); valid = true; } catch (ArgumentException) { Console.WriteLine(Other.ToString()); GetOneEquipment(shopLogic); } if (valid) { Console.WriteLine(Selected.ToString()); Console.WriteLine(shopLogic?.GetSkiEquipmentsById(id).ToString()); } Console.ReadLine(); }
/// <summary> /// Lists all the beginner customers who use credit card. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void BeginnersWithCreditCard(ShopLogic shopLogic) { foreach (var item in shopLogic?.BeginnersWithCreditCard()) { Console.WriteLine(item); Console.ReadLine(); } }
/// <summary> /// It lists all the skis, that have promotion. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void PromotionOver170(ShopLogic shopLogic) { foreach (var item in shopLogic?.PromotionOver170()) { Console.WriteLine(item); Console.ReadLine(); } }
/// <summary> /// It lists all the Head skis for which they have already been paid. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void PaidHead(ShopLogic shopLogic) { foreach (var item in shopLogic?.PaidHead()) { Console.WriteLine(item); Console.ReadLine(); } }
private void Awake() { saveSystem = GetComponent <SaveSystem>(); levelController = GetComponent <LevelController>(); shopLogic = GetComponent <ShopLogic>(); Advertisement.Initialize(gameId, true); StartCoroutine(ShowBannerWhenReady()); Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER); }
void Awake() { lockUnlock = GameObject.FindWithTag("LockUnlock"); economy_ui = GameObject.FindWithTag("ECONOMY_UI"); buttonShop = GameObject.FindWithTag("ButtonShop"); shop = GameObject.FindWithTag("SHOP"); roomsLogic = GameObject.FindWithTag("ROOMS_LOGIC").GetComponent <RoomsLogic>(); shopLogic = GameObject.FindWithTag("SHOP_LOGIC").GetComponent <ShopLogic>(); }
/// <summary> /// Deletes the shop. /// </summary> private void DeleteShop() { if (ShopLogic.DeleteShop(ShopID)) { json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK)); } else { json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.除失败)); } }
/// <summary> /// This method lists all the Ski equipments. /// </summary> /// <param name="shopL">Logic for Orders repository and SkiEqupments repository.</param> public static void ListAllS(ShopLogic shopL) { const string value = "\n:: ALL Equipments ::\n"; Console.WriteLine(value.ToString()); shopL?.GetAllSkiEquipments() .ToList() .ForEach(x => Console.WriteLine(x.ToString())); Console.ReadLine(); }
void Awake() { index = -1; PARENT = transform.parent.gameObject; lockUnlock = GameObject.FindWithTag("LockUnlock"); economy_ui = GameObject.FindWithTag("ECONOMY_UI"); buttonShop = GameObject.FindWithTag("ButtonShop"); shop = GameObject.FindWithTag("SHOP"); roomsLogic = GameObject.FindWithTag("ROOMS_LOGIC").GetComponent <RoomsLogic>(); shopLogic = GameObject.FindWithTag("SHOP_LOGIC").GetComponent <ShopLogic>(); }
/// <summary> /// Lists with task, all the beginner customers who use credit card. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void BeginnersWithCreditCardAsync(ShopLogic shopLogic) { var task = shopLogic?.BeginnersWithCreditCardAsync(); task.Wait(); foreach (var item in task.Result) { Console.WriteLine(item); Thread.Sleep(500); } Console.ReadLine(); }
/// <summary> /// Writes out with task, all the skis, that have promotion. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void PromotionOver170Async(ShopLogic shopLogic) { var task = shopLogic?.PromotionOver170Async(); task.Wait(); foreach (var item in task.Result) { Console.WriteLine(item); Thread.Sleep(500); } Console.ReadLine(); }
/// <summary> /// 冻结或解冻门店 /// </summary> private void UpdateShopActive() { int active = GetFormValue("active", 1); if (ShopLogic.UpdateShopActive(ShopID, active)) { json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK)); } else { json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.更新失败)); } }
/// <summary> /// It asks about equipment datas. /// </summary> /// <param name="shop">Logic for Orders repository and SkiEqupments repository.</param> public static void InsterEquipment(ShopLogic shop) { shop?.GetAllSkiEquipments().ToList().ForEach(x => Console.WriteLine(x)); int orderID = IntParse("\nEnter order's ID: "); string name = string.Empty; do { ToConsole("\nEnter name: "); name = Console.ReadLine(); }while (name == null); string manufacturer = string.Empty; do { ToConsole("\nEnter manufacturer: "); manufacturer = Console.ReadLine(); }while (manufacturer == null); string difficulty = string.Empty; do { ToConsole("\nEnter difficulty: (beginner / advanced / pro)"); difficulty = Console.ReadLine(); }while (difficulty == null); int price = IntParse("\nEnter price:"); int size = IntParse("\nEnter size:"); string validS = string.Empty; bool valid = false; do { ToConsole("\nEnter payment status: (y/n)"); validS = Console.ReadLine(); }while (validS != "y" & validS != "n"); if (validS == "y") { valid = true; } shop?.CreateEquipment(new Data.SkiEquipments() { OrderId = orderID, Name = name, Manufacturer = manufacturer, Difficulty = difficulty, Price = price, Size = size, Status = valid }); }
public InternalAdditionalLogics(InternalAccessors accessors, IApplyManager storage, LogicData data, IServerAPI api) { ImpactController = new ImpactController(data.IsEmulate); ContextLogic = ContextLogic.CreateClient(accessors.BattleAccessor, accessors.UnitsAccessor); DropLogic = DropLogic.CreateClient(accessors.ScorersAccessor, accessors.InventoryAccessor, accessors.UnitsAccessor, accessors.ExplorerAccessor, accessors.FormulaController, ImpactController); ScorersLogic = ScorersLogic.CreateClient(accessors.BattleAccessor, accessors.ScorersAccessor, accessors.ExplorerAccessor); ShopLogic = ShopLogic.CreateClient(accessors.SettingsAccessor, accessors.ShopAccessor, accessors.FormulaController); ApplyChangeLogic = ApplyChangeLogic.CreateClient(storage, ContextLogic); FormulaLogic = FormulaLogic.CreateClient(ContextLogic, accessors.ScorersAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.ExplorerAccessor, data, accessors.PlayerAccessor, accessors.SettingsAccessor, accessors.ConditionController, accessors.FormulaController, ScorersLogic); BuffLogic = BuffLogic.CreateClient(accessors.BattleAccessor, ContextLogic, ApplyChangeLogic); ExplorerLogic = ExplorerLogic.CreateClient(accessors.ScorersAccessor, accessors.ExplorerAccessor, accessors.UnitsAccessor, accessors.FormulaController, ScorersLogic, ContextLogic, DropLogic, ImpactController); TriggerLogic = TriggerLogic.CreateClient(accessors.BattleAccessor, FormulaLogic); ConditionLogic = ConditionLogic.CreateClient(accessors.InventoryAccessor, accessors.ScorersAccessor, accessors.PlayerAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.ExplorerAccessor, accessors.SettingsAccessor, accessors.AchievementAccessor, FormulaLogic, ContextLogic, ScorersLogic, data, accessors.ConditionController); BattleLogic = BattleLogic.CreateClient(ApplyChangeLogic, ContextLogic, ConditionLogic, accessors.FormulaController, accessors.BattleAccessor, accessors.ScorersAccessor, accessors.UnitsAccessor, accessors.ExplorerAccessor, accessors.SettingsAccessor); ImpactLogic = ImpactLogic.CreateClient(accessors.ScorersAccessor, accessors.PlayerAccessor, accessors.InventoryAccessor, accessors.ExplorerAccessor, accessors.UnitsAccessor, accessors.BattleAccessor, accessors.SettingsAccessor, accessors.AchievementAccessor, BattleLogic, FormulaLogic, accessors.ConditionController, ApplyChangeLogic, BuffLogic, ScorersLogic, ContextLogic, ImpactController, data); }
/// <summary> /// 获取门店列表 /// </summary> private void GetShopList() { int shopType = user.UserIndentity == 0 ? 1 : 2; int shopBelongId = user.UserIndentity == 0 ? 0 : user.ID; SearchModel model = new SearchModel() { PageIndex = Convert.ToInt32(GetFormValue("pageIndex", 1)), PageSize = Convert.ToInt32(GetFormValue("pageSize", 20)), startTime = GetFormValue("startTime", ""), endTime = GetFormValue("endTime", ""), key = GetFormValue("key", ""), city = GetFormValue("city", ""), province = GetFormValue("prov", "") }; var data = ShopLogic.GetShopList(shopType, shopBelongId, model); json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK, data)); }
void Start() { labelTextObj = transform.Find("LabelText").gameObject; // Count each type of Card. Pack pack = ShopLogic.packInventory[packId]; string packName = pack.packName; List <CardInfo> packCards = pack.cardList; Dictionary <string, int> cardNameCounts = new Dictionary <string, int>(); foreach (CardInfo cardInfo in packCards) { if (!cardNameCounts.ContainsKey(cardInfo.cardName)) { cardNameCounts[cardInfo.cardName] = 0; } cardNameCounts[cardInfo.cardName] += 1; } // Display something like "3 x [ ]" for each type of Card. Transform cardsContainer = transform.Find("CardsContainer"); Transform cardsViewport = cardsContainer.Find("Viewport"); Transform cardsContent = cardsViewport.Find("Content"); foreach (string cardName in cardNameCounts.Keys) { string cardId = MiscHelpers.getRandomId(); CardInfo cardInfo = new CardInfo(cardName, cardId); GameObject cardObj = PrefabInstantiator.P.CreateCard( cardInfo, cardsContent, isInTrial: false ); GameObject aboveCardTextObj = cardObj.transform.Find("AboveCardText").gameObject; Text numCardRepeatsText = aboveCardTextObj.GetComponent <Text>(); numCardRepeatsText.text = $"{cardNameCounts[cardName]} x "; } // Display the price of this pack. int price = ShopLogic.getBaseCashValueOfPack(packId); labelTextObj.GetComponent <Text>().text = $"{packName} - Price: {price}"; }
/// <summary> /// This lists the payment method changing method. /// </summary> /// <param name="shopLogic">Logic for Orders repository and SkiEqupments repository.</param> public static void ChangePayment(ShopLogic shopLogic) { int id = IntParse(Enter.ToString()); bool valid = false; try { shopLogic?.GetOrderById(id); valid = true; } catch (ArgumentException) { Console.WriteLine(Other.ToString()); } if (valid) { Console.WriteLine(Selected.ToString()); Console.WriteLine(shopLogic?.GetOrderById(id).ToString()); Console.WriteLine(PressEnter.ToString()); valid = false; string payment = string.Empty; do { const string Npm = "Enter new payment method here: (Credit Card/PayPal)"; payment = Console.ReadLine(); Console.WriteLine(Npm.ToString()); if (payment == "Credit Card" || payment == "PayPal") { valid = true; } }while (!valid); shopLogic?.ChangePayment(id, payment); Console.WriteLine(Saved.ToString()); } Console.ReadLine(); }
/* PUBLIC API */ public void clickStartTrial() /* Click handler for button that starts the campaign. */ { // Put the purchased packs into the deck. foreach (string packId in ShopLogic.packsAddedToCart) { Pack pack = ShopLogic.packInventory[packId]; List <CardInfo> packCards = pack.cardList; foreach (CardInfo cardInfo in packCards) { CampaignLogic.campaignDeck[cardInfo.cardId] = cardInfo; } } // Pay the money. CampaignLogic.currentCash -= ShopLogic.getExpensesInCart(); ShopLogic.clearCart(); // Start the trial. SceneManager.LoadScene("TrialScene"); }
public void AddShop() { var mock = new Mock <IShopDao>(); mock.Setup(item => item.AddShop(It.IsAny <Shop>())).Returns(100); var logic = new ShopLogic(mock.Object); var shop = new Shop() { NameShop = "Lime", Address = "Зарубина", DescriptionShop = "Кафе", Website = "lime.ru", Rating = 0, PhoneShop = "+7909323232", City = "Saratov", OpeningHours = "9:00-21:00" }; int id = logic.AddShop(shop); Assert.AreEqual(id, 100, "Id is not equal"); }
public void GetShops() { var mock = new Mock <IShopDao>(); mock.Setup(item => item.GetShops()).Returns(new List <Shop>() { new Shop() { NameShop = "Lime", Address = "Зарубина", DescriptionShop = "Кафе", Website = "lime.ru", Rating = 0, PhoneShop = "+7909323232", City = "Saratov", OpeningHours = "9:00-21:00" } }); var logic = new ShopLogic(mock.Object); var shops = logic.GetShops().ToList(); Assert.AreEqual(shops.Count, 1); }
/* PUBLIC API */ public void clickAddPack() /* Override this function of IPointerClickHandler. Triggers when this PackDisplay is clicked. * * :param PointerEventData eventData: This interface is defined by Unity. */ { if (ShopLogic.packsAddedToCart.Contains(packId)) { ShopLogic.packsAddedToCart.Remove(packId); labelTextObj.GetComponent <Text>().fontStyle = FontStyle.Normal; } else { int availableCash = CampaignLogic.currentCash - ShopLogic.getExpensesInCart(); int packPrice = ShopLogic.getBaseCashValueOfPack(packId); if (availableCash >= packPrice) { ShopLogic.packsAddedToCart.Add(packId); labelTextObj.GetComponent <Text>().fontStyle = FontStyle.Bold; } } }
/// <summary> /// It asks about order datas. /// </summary> /// <param name="shop">Logic for Orders repository and SkiEqupments repository.</param> public static void InsterOrder(ShopLogic shop) { shop?.GetAllOrders().ToList().ForEach(x => Console.WriteLine(x)); string payment = string.Empty; do { ToConsole("\nEnter payment:"); payment = Console.ReadLine(); }while (payment == "Credit Card" || payment == "PayPal"); DateTime firstdate = DateParse("\nEnter first date:"); DateTime lastdate = DateParse("\nEnter last date:"); int promotion = IntParse("\nEnter promotion:"); string validS = string.Empty; bool valid = false; do { ToConsole("\nEnter payment status: (y/n)"); validS = Console.ReadLine(); }while (validS != "y" & validS != "n"); if (validS == "y") { valid = true; } int customerID = IntParse("\nEnter customer's ID: "); shop?.CreateOrder(new Data.Order() { CustomerId = customerID, Payment = payment, FirstDate = firstdate, LastDate = lastdate, Promotion = promotion, CustomerPaid = valid }); ToConsole("\nNew order successfully created!"); ListAllO(shop); }
/// <summary> /// 修改门店信息 /// </summary> private void UpdateShopInfo() { string shopname = GetFormValue("shopname", ""); string username = GetFormValue("username", ""); string usermobile = GetFormValue("usermobile", ""); string userloginname = GetFormValue("userloginname", ""); string password = GetFormValue("password", ""); string shopprov = GetFormValue("shopprov", ""); string shopcity = GetFormValue("shopcity", ""); string shopaddress = GetFormValue("shopaddress", ""); ApiStatusCode apiCode; bool flag = ShopLogic.EditShopInfo(new ShopModel() { ShopID = ShopID, ShopName = shopname, ShopArea = "", ShopAddress = shopaddress, ShopBelongId = user.UserIndentity == 0 ? 0 : user.ID, ShopCity = shopcity, ShopProv = shopprov, Contacts = username, ContactWay = usermobile, LoginName = userloginname, LoginPassword = password, IsActive = 1, ShopType = user.UserIndentity == 0 ? 1 : 2 }, out apiCode); if (flag) { json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK)); } else { json = JsonHelper.JsonSerializer(new ResultModel(apiCode)); } }
public static StartSessionModule CreateClient(UnitsAccessor _units, ScorersAccessor _scorers, BattleAccessor _battle, InventoryAccessor _inventory, PlayerAccessor _player, ExplorerAccessor _explorer, LogAccessor _accessor, SettingsAccessor _settings, ShopAccessor _shop, LogAccessor _log, AchievementAccessor _achievement, BattleLogic _battleLogic, ShopLogic _shopLogic, ExplorerLogic _explorerLogic, FormulaController _formula, ImpactController _logic) { return(new StartSessionModule { _units = _units, _scorers = _scorers, _battle = _battle, _inventory = _inventory, _player = _player, _explorer = _explorer, _accessor = _accessor, _settings = _settings, _shop = _shop, _log = _log, _achievement = _achievement, _battleLogic = _battleLogic, _shopLogic = _shopLogic, _explorerLogic = _explorerLogic, _formula = _formula, _logic = _logic, } ); }
public static ShopModule CreateClient(ScorersAccessor _scorers, ShopAccessor _shop, FormulaLogic _formula, ImpactController _impacts, ShopLogic _shopLogic, DropLogic _dropLogic) { return(new ShopModule { _scorers = _scorers, _shop = _shop, _formula = _formula, _impacts = _impacts, _shopLogic = _shopLogic, _dropLogic = _dropLogic, } ); }
void Start() { shopLogic = GameObject.FindWithTag("SHOP_LOGIC").GetComponent <ShopLogic>(); }