Ejemplo n.º 1
0
        public void SetUp()
        {
            _gamePackageName = "dummy.package.name";
            _token           = "dummy-token";

            // Setup products for testing
            _defaultIAPid = "test-default-id";
            //
            _testIAPids = new List <string>()
            {
                "test-1-id",
                "test-2-id",
                "test-3-id",
                "test-4-id",
                "test-5-id"
            };

            // Setup product lookup
            _productsLookup = new Dictionary <string, ApprienProduct>();
            _productsLookup[_defaultIAPid] = new ApprienProduct(_defaultIAPid, ProductType.Consumable);

            // Add IAP ids to the catalog
            _catalog = new ProductCatalog();
            _catalog.Add(new ProductCatalogItem()
            {
                id = _defaultIAPid, type = ProductType.Consumable
            });

            // Create UnityPurchasing Products
            _builder = ConfigurationBuilder.Instance(new DummyPurchasingModule());
            _builder.AddProduct(_defaultIAPid, ProductType.Consumable);

            foreach (var id in _testIAPids)
            {
                _productsLookup[id] = new ApprienProduct(id, ProductType.Consumable);
                _catalog.Add(new ProductCatalogItem()
                {
                    id = id, type = ProductType.Consumable
                });
                _builder.AddProduct(id, ProductType.Consumable);
            }

#if NET_4_6 || NET_STANDARD_2_0
            _mockServer = FluentMockServer.Start();
#endif
            _apprienManager = new ApprienManager(
                _gamePackageName,
                ApprienIntegrationType.GooglePlayStore,
                _token
                );
        }
Ejemplo n.º 2
0
        private static void CompositeDesignPattern()
        {
            var items             = new ProductCatalog("Ürünler");
            var phones            = new ProductCatalog("Telefonlar");
            var iphone            = new ProductCatalog("İphone Telefon");
            var samsung           = new ProductCatalog("Samsung Telefon");
            var iphone5Item       = new DesignPattern.Structural.Composite.Product("Iphone 5");
            var samsungGalaxyItem = new DesignPattern.Structural.Composite.Product("Samsung Galaxy");

            //En Üst hiyararşiye Telefonlar eklendi
            items.Add(phones);
            //Telefonlar hiyararşisine iphone ve samsung ekledik
            phones.Add(iphone);
            phones.Add(samsung);

            //Iphone ve samsung hiyerarşisine Iphone5 ve samsung galaxy ekledik
            iphone.Add(iphone5Item);
            samsung.Add(samsungGalaxyItem);
            //hiyerarşiyi ekrana yazdık
            items.Hierarchy();
        }