Esempio n. 1
0
        /// <summary>
        /// Setup the Mocking Library for in app purchases
        /// </summary>
        public static void SetupMockIap()
        {
            MockIAP.Init();
            MockIAP.ClearCache();
            MockIAP.RunInMockMode(true);

            // Default listing information to test iap
            // Use the current culture to retrieve products for the current mobile phone
            MockIAP.SetListingInformation(1, CultureInfo.CurrentUICulture.Name, "Test description", "1", "TestApp");

            // Needed 1 product to check products in license service is available
            var p = new ProductListing
            {
                Name           = "Test",
                ProductId      = "Test",
                ImageUri       = null,
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new[] { "Test" },
                Description    = "Test",
                FormattedPrice = "0.99",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("Test", p);
        }
Esempio n. 2
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Remove Ads", "1", "MemorySquared");

            // ADD ONE ITEM TO PURCHASE WHICH WILL BE THE VERSION
            // OF THE GAME WITHOUT ADS:

            ProductListing p = new ProductListing
            {
                Name = "RemoveAds",
                //ImageUri = new Uri("/Res/Image/1.png", UriKind.Relative),
                ProductId      = "RemoveAds",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "Remove", "Ads" },
                Description    = "This will remove ads from the app",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("RemoveAds", p);
#endif
        }
Esempio n. 3
0
        public static void LoadTest(uint ageRating, string currentMarket, string description, string formattedPrice, string name, Dictionary <string, ProductListing> products)
        {
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(ageRating, currentMarket, description, formattedPrice, name);

            foreach (var productListing in products)
            {
                var key     = productListing.Key;
                var product = productListing.Value;
                // Add some more items manually.
                var p = new MockIAPLib.ProductListing
                {
                    Name           = product.Name,
                    ProductId      = product.ProductId,
                    ProductType    = (Windows.ApplicationModel.Store.ProductType)product.ProductType,
                    Description    = product.Description,
                    FormattedPrice = product.FormattedPrice,
                    Tag            = string.Empty
                };
                MockIAP.AddProductListing(key, p);
            }
#endif
        }
Esempio n. 4
0
        /// <summary>
        /// Add a MEGA product as test product to the Mock Iap library
        /// </summary>
        /// <param name="product">MEGA product to add to Mock Iap</param>
        public static void AddProductToMockIap(Product product)
        {
            if (product == null)
            {
                return;
            }

            string productId = product.MicrosoftStoreId;

            // Only add the products once
            if (!MockIAP.allProducts.ContainsKey(productId))
            {
                var p = new ProductListing
                {
                    Name           = product.Name + " (" + product.Months + " months)",
                    ProductId      = productId,
                    ImageUri       = null,
                    ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                    Keywords       = new[] { productId },
                    Description    = product.Name,
                    FormattedPrice = product.FormattedPrice,
                    Tag            = string.Empty
                };

                MockIAP.AddProductListing(productId, p);
            }
        }
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "nl-nl", "desc", "1", "Treintijden");

            ProductListing p = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "9.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade1.png", UriKind.Relative),
                Name           = "Passagier",
                ProductId      = "upgrade1",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };
            ProductListing p2 = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "2.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade2.png", UriKind.Relative),
                Name           = "Conducteur",
                ProductId      = "upgrade2",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };

            ProductListing p3 = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "5.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade3.png", UriKind.Relative),
                Name           = "Machinist",
                ProductId      = "upgrade3",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };



            MockIAP.AddProductListing("upgrade1", p);
            MockIAP.AddProductListing("upgrade2", p2);
            MockIAP.AddProductListing("upgrade3", p3);
#endif
        }
Esempio n. 6
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Removes all playback limits", "3", "MusicPimp Premium");

            // Add some more items manually.
            ProductListing p = new ProductListing {
                Name           = "MusicPimp Premium",
                ImageUri       = new Uri("/Assets/Icons/browser.png", UriKind.Relative),
                ProductId      = "org.musicpimp.premium",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "premium" },
                Description    = "Removes all playback limits. Does not expire.",
                FormattedPrice = "€1.99",
                Tag            = string.Empty
            };
            MockIAP.AddProductListing("org.musicpimp.premium", p);
#endif
        }
Esempio n. 7
0
        private void InitializeMockIAP()
        {
#if (DEBUG && BETA) || DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", string.Empty, "0.99", "Voice Memos");

            // Add some more items manually.

            ProductListing p = new ProductListing
            {
                Name           = "Voice Memos Premium",
                ImageUri       = new Uri("/Assets/IAPImages/Premium.png", UriKind.Relative),
                ProductId      = "VoiceMemosPremium",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                FormattedPrice = "$0.99",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("VoiceMemosPremium", p);
#endif
        }
Esempio n. 8
0
        /// <summary>
        /// Add a MEGA product as test product to the Mock Iap library
        /// </summary>
        /// <param name="product">MEGA product to add to Mock Iap</param>
        public static void AddProductToMockIap(Product product)
        {
            string productId = string.Empty;

            switch (product.AccountType)
            {
            case MAccountType.ACCOUNT_TYPE_PROI:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro1.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro1.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_PROII:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro2.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro2.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_PROIII:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro3.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro3.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_LITE:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.prolite.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.prolite.oneYear`";
                    break;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Only add the products once
            if (!MockIAP.allProducts.ContainsKey(productId))
            {
                var p = new ProductListing
                {
                    Name           = product.Name + " (" + product.Months + " months)",
                    ProductId      = productId,
                    ImageUri       = null,
                    ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                    Keywords       = new[] { productId },
                    Description    = product.Name,
                    FormattedPrice = product.Price,
                    Tag            = string.Empty
                };

                MockIAP.AddProductListing(productId, p);
            }
        }
Esempio n. 9
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "TestApp");

            // Add some more items manually.

            ProductListing p = new ProductListing
            {
                Name           = "img.1",
                ImageUri       = new Uri("/Res/Image/1.png", UriKind.Relative),
                ProductId      = "img.1",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.1", p);

            p = new ProductListing
            {
                Name           = "img.2",
                ImageUri       = new Uri("/Res/Image/2.png", UriKind.Relative),
                ProductId      = "img.2",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.2", p);

            p = new ProductListing
            {
                Name           = "img.3",
                ImageUri       = new Uri("/Res/Image/3.png", UriKind.Relative),
                ProductId      = "img.3",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.3", p);

            p = new ProductListing
            {
                Name           = "img.4",
                ImageUri       = new Uri("/Res/Image/4.png", UriKind.Relative),
                ProductId      = "img.4",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.4", p);

            p = new ProductListing
            {
                Name           = "img.5",
                ImageUri       = new Uri("/Res/Image/5.png", UriKind.Relative),
                ProductId      = "img.5",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.5", p);

            p = new ProductListing
            {
                Name           = "img.6",
                ImageUri       = new Uri("/Res/Image/6.png", UriKind.Relative),
                ProductId      = "img.6",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.6", p);
#endif
        }