public void Verify_SinglePricingRule_DealPricing_DoubleDeals(int getAmount, int forAmount, Type adType, decimal expected) { var pricingRule = new GetXForYPricingRule(getAmount, forAmount, adType); var adFactory = new AdFactory(); var checkout = new Domain.Checkout(new List <IPricingRule> { pricingRule }); var item1 = adFactory.CreateAd(adType); var item2 = adFactory.CreateAd(adType); var item3 = adFactory.CreateAd(adType); var item4 = adFactory.CreateAd(adType); var item5 = adFactory.CreateAd(adType); var item6 = adFactory.CreateAd(adType); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); checkout.Add(item4); checkout.Add(item5); checkout.Add(item6); var total = checkout.Total(); Assert.Equal(expected, total); }
public void Verify_DoublePricingRule_Discount() { var adFactory = new AdFactory(); var pricingRule1 = new DiscountPricingRule(typeof(StandoutAd), 22.99m); var pricingRule2 = new DiscountPricingRule(typeof(ClassicAd), 69.99m); var pricingRules = new List <IPricingRule>(); pricingRules.Add(pricingRule1); pricingRules.Add(pricingRule2); var checkout = new Domain.Checkout(pricingRules); var item1 = adFactory.CreateAd(typeof(StandoutAd)); var item2 = adFactory.CreateAd(typeof(ClassicAd)); checkout.Add(item1); checkout.Add(item2); var total = checkout.Total(); Assert.Equal(500, total); }
public void Verify_AxilCustomer_Total(string name, decimal expected) { var adFactory = new AdFactory(); var discountStrategyFactory = new DiscountStrategyFactory(); var item1 = adFactory.CreateAd(typeof(StandoutAd)); var item2 = adFactory.CreateAd(typeof(StandoutAd)); var item3 = adFactory.CreateAd(typeof(StandoutAd)); var item4 = adFactory.CreateAd(typeof(PremiumAd)); var customer = new Customer(name); var discountStrategy = discountStrategyFactory.GetDiscountStrategy(customer); var pricingRules = discountStrategy.GetPricingRules(); var checkout = new Domain.Checkout(pricingRules); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); checkout.Add(item4); Assert.Equal(expected, checkout.Total()); }
private void InitSDK_Click(Object sender, RoutedEventArgs e) { // SDK Config: additional options VungleSDKConfig sdkConfig = new VungleSDKConfig(); // Set minimum disk space required to initialize or load ads (in bytes) //sdkConfig.MinimumDiskSpaceForAd = 50 * 1024; //sdkConfig.MinimumDiskSpaceForInit = 50 * 1024; //Disable tracking of Hardare ID //sdkConfig.DisableAshwidTracking = true; sdkConfig.DisableBannerRefresh = false; // Obtain Vungle SDK instance sdkInstance = AdFactory.GetInstance(appID, sdkConfig); this.vungleBannerControl.AppID = appID; sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentAccepted, "1.0"); //Register event handlers sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdStart += SdkInstance_OnAdStart; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.Diagnostic += SdkInstance_Diagnostic; sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted; InitSDK.IsEnabled = false; }
private void InitSDK_Click(Object sender, RoutedEventArgs e) { // Obtain Vungle SDK instance // As of v6 including placements in initialization call is no longer required sdkInstance = AdFactory.GetInstance(appID); // SDK Config: additional options // Set minimum disk space required to initialize or load ads (in bytes) //VungleSDKConfig sdkConfig = new VungleSDKConfig(); //sdkConfig.MinimumDiskSpaceForAd = 50 * 1024 * 1024; //sdkConfig.MinimumDiskSpaceForInit = 50 * 1024 * 1024; //sdkInstance = AdFactory.GetInstance(appID, sdkConfig) //Disable tracking of Hardare ID //sdkConfig.DisableAshwidTracking = true; //Register event handlers sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdStart += SdkInstance_OnAdStart; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.Diagnostic += SdkInstance_Diagnostic; sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted; InitSDK.IsEnabled = false; }
public void Verify_PricingRule_DiscountOfYPriceForXItems() { var adFactory = new AdFactory(); var pricingRule1 = new DiscountOfYForXItems(typeof(PremiumAd), 15m, 4); var pricingRules = new List <IPricingRule>(); pricingRules.Add(pricingRule1); var checkout = new Domain.Checkout(pricingRules); var item1 = adFactory.CreateAd(typeof(PremiumAd)); var item2 = adFactory.CreateAd(typeof(PremiumAd)); var item3 = adFactory.CreateAd(typeof(PremiumAd)); var item4 = adFactory.CreateAd(typeof(PremiumAd)); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); checkout.Add(item4); var total = checkout.Total(); Assert.Equal(1519.96m, total); }
public void Verify_MixedPricingRules_Deal_and_Discount() { var adFactory = new AdFactory(); var pricingRule1 = new DiscountPricingRule(typeof(StandoutAd), 22.99m); var pricingRule2 = new GetXForYPricingRule(3, 2, typeof(ClassicAd)); var pricingRules = new List <IPricingRule>(); pricingRules.Add(pricingRule1); pricingRules.Add(pricingRule2); var checkout = new Domain.Checkout(pricingRules); var item1 = adFactory.CreateAd(typeof(StandoutAd)); var item2 = adFactory.CreateAd(typeof(ClassicAd)); var item3 = adFactory.CreateAd(typeof(ClassicAd)); var item4 = adFactory.CreateAd(typeof(ClassicAd)); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); checkout.Add(item4); var total = checkout.Total(); Assert.Equal(839.98m, total); }
public void InitializeVungle(string appID) { m_vungle = AdFactory.GetInstance(appID); m_vungle.OnInitCompleted += M_vungle_OnInitCompleted; m_vungle.OnAdPlayableChanged += M_vungle_OnAdPlayableChanged; m_vungle.Diagnostic += M_vungle_Diagnostic; }
// Starts up the SDK with the given appId public static void init(string appId, string version) { VungleSDKConfig config = new VungleSDKConfig(); config.SetPluginName("unity"); config.SetPluginVersion(version); sdk = AdFactory.GetInstance(appId, config); sdk.addOnEvent(VungleManager.onEvent); }
// Starts up the SDK with the given appId public static void init( string appId, string version, params string[] placements ) { VungleSDKConfig config = new VungleSDKConfig (); config.SetPluginName ("unity"); config.SetPluginVersion (version); config.SetApiEndpoint(new Uri("http://ads.api.vungle.com")); sdk = AdFactory.GetInstance(appId, config, placements); sdk.addOnEvent(VungleManager.onEvent); }
public MainPage() { this.InitializeComponent(); //Obtain Vungle SDK instance sdkInstance = AdFactory.GetInstance("vungleTest"); //Register OnAdPlayableChanged event handler sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; }
private void InitSDK_Click(Object sender, RoutedEventArgs e) { //Obtain Vungle SDK instance sdkInstance = AdFactory.GetInstance(appID, new string[] { placement1, placement2, placement3 }); //Register event handlers sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdStart += SdkInstance_OnAdStart; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.Diagnostic += SdkInstance_Diagnostic; sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted; InitSDK.IsEnabled = false; }
public MainPage() { InitializeComponent(); // Obtain Vungle SDK instance sdkInstance = AdFactory.GetInstance("591236625b2480ac40000028", new string[] { "DEFAULT18080" }); // Register event handlers sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdStart += SdkInstance_OnAdStart; sdkInstance.OnVideoView += SdkInstance_OnVideoView; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.Diagnostic += SdkInstance_Diagnostic; }
public MainPage() { InitializeComponent(); // Obtain Vungle SDK instance sdkInstance = AdFactory.GetInstance("Test_Windows"); // Register event handlers sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdStart += SdkInstance_OnAdStart; sdkInstance.OnVideoView += SdkInstance_OnVideoView; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.Diagnostic += SdkInstance_Diagnostic; }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { ViewModel.AdLoadingSpinnerVisibility = Visibility.Visible; _adRequested = true; if (VungleAdInstance == null) { VungleAdInstance = AdFactory.GetInstance("5735f9ae0b3973633c00004b"); VungleAdInstance.OnAdPlayableChanged += VungleAdInstanceOnOnAdPlayableChanged; } else { VungleAdInstanceOnOnAdPlayableChanged(null, null); } }
public void Owner_CreateOwnerAd() { Owner Owner = (Owner)UserFactory.CreateOwner("Owner123", "testnaLozinka", "Ivan", "Horvat", "123456789", "Unska 3", "Zagreb", 40, UserType.OWNER); OwnerAd OwnerAd = (OwnerAd)AdFactory.CreateOwnerAd(40.0, "Setam pse POVOLJNO", AdStatus.ACTIVE, "Obozavam pse", new DateTime(2019, 8, 28, 12, 5, 0), 3, 4, Owner); Owner.AddAd((OwnerAd)OwnerAd); UserRepository repository = new UserRepository(); repository.AddUser(Owner); Debug.Assert(OwnerAd.Equals(Owner.Ads[0])); repository.DeleteUser(Owner); }
public void Verify_Ads_Count() { var adFactory = new AdFactory(); var checkout = new Domain.Checkout(); var item1 = adFactory.CreateAd(typeof(ClassicAd)); var item2 = adFactory.CreateAd(typeof(ClassicAd)); checkout.Add(item1); checkout.Add(item2); var count = checkout.Items.Count; Assert.Equal(2, count); }
public void Verify_NoPricingRules_OneTypeAds_TotalPrice() { var adFactory = new AdFactory(); var checkout = new Domain.Checkout(); var item1 = adFactory.CreateAd(typeof(ClassicAd)); var item2 = adFactory.CreateAd(typeof(ClassicAd)); checkout.Add(item1); checkout.Add(item2); var total = checkout.Total(); Assert.Equal(539.98m, total); }
public ADPage() { this.InitializeComponent(); sdkInstance = AdFactory.GetInstance(appID, interst); //为广告位置加载广告 // sdkInstance.LoadAd(interst); //广告状态改变后事件 sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; sdkInstance.OnAdEnd += SdkInstance_OnAdEnd; sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted; }
public Vungle.Consent GetCCPAStatus() { int status = AdFactory.GetCCPAStatus(); switch (status) { case 2: return(Vungle.Consent.Denied); case 1: return(Vungle.Consent.Accepted); default: return(Vungle.Consent.Undefined); } }
public void Walker_CreateWalkerAd() { Walker Walker = (Walker)UserFactory.CreateWalker("Walker123", "testnaLozinka", "Ivan", "Horvat", "123456789", "Unska 3", "Zagreb", 40, UserType.WALKER, true, false); WalkerAd WalkerAd = (WalkerAd)AdFactory.CreateWalkerAd(40.0, "Setam pse POVOLJNO", AdStatus.ACTIVE, "Obozavam pse", new DateTime(2019, 8, 28, 12, 5, 0), 3, 4, Walker); Walker.AddAd((WalkerAd)WalkerAd); UserRepository repository = new UserRepository(); repository.AddUser(Walker); Debug.Assert(WalkerAd.Equals(Walker.Ads[0])); repository.DeleteUser(Walker); }
public void Verify_Ads_Description() { var adFactory = new AdFactory(); var checkout = new Domain.Checkout(); var item1 = adFactory.CreateAd(typeof(ClassicAd)); var item2 = adFactory.CreateAd(typeof(StandoutAd)); var item3 = adFactory.CreateAd(typeof(PremiumAd)); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); Assert.Equal("Offers the most basic level of advertisement", checkout.Items[0].Description); Assert.Equal("Allows advertisers to use a company logo and use a longer presentation text", checkout.Items[1].Description); Assert.Equal("Same benefits as Standout Ad, but also puts the advertisement at the top of the results, allowing higher visibility", checkout.Items[2].Description); }
public Ad CreateAd(IAdView AdView, IUserRepository UserRepository, User CurrentUser) { AdView.AdjustCreateView(); double Price = AdView.Price; DateTime Date = DateTime.Now.Date; string Description = AdView.Description; string Title = AdView.Title; AdStatus AdStatus = AdStatus.ACTIVE; int DogsNumber = AdView.DogsNumber; int Hours = AdView.Hours; Ad Ad; if (Description == "" || Title == "") { MessageBox.Show("Obvezno je ispuniti sva polja"); return(null); } if (Price <= 0 || DogsNumber <= 0 || Hours <= 0) { MessageBox.Show("Broj godina/Cijena/Broj pasa ne može manji ili jednak 0"); return(null); } if (CurrentUser.UserType == UserType.WALKER) { Ad = AdFactory.CreateWalkerAd(Price, Title, AdStatus, Description, Date, DogsNumber, Hours, (Walker)CurrentUser); Walker Walker = (Walker)CurrentUser; Walker.AddAd((WalkerAd)Ad); UserRepository.UpdateUser(Walker); } else { Ad = AdFactory.CreateOwnerAd(Price, Title, AdStatus, Description, Date, DogsNumber, Hours, (Owner)CurrentUser); Owner Owner = (Owner)CurrentUser; Owner.AddAd((OwnerAd)Ad); UserRepository.UpdateUser(Owner); } var form = (Form)AdView; form.Hide(); return(Ad); }
public void Verify_NoPricingRules_MultipleTypeAds_TotalPrice() { var adFactory = new AdFactory(); var checkout = new Domain.Checkout(); var item1 = adFactory.CreateAd(typeof(ClassicAd)); var item2 = adFactory.CreateAd(typeof(StandoutAd)); var item3 = adFactory.CreateAd(typeof(PremiumAd)); checkout.Add(item1); checkout.Add(item2); checkout.Add(item3); var total = checkout.Total(); Assert.Equal(987.97m, total); }
public void Verify_SinglePricingRule_Discount(Type type, decimal discount, decimal expected) { var adFactory = new AdFactory(); var pricingRule = new DiscountPricingRule(type, discount); var checkout = new Domain.Checkout(new List <IPricingRule> { pricingRule }); var item1 = adFactory.CreateAd(type); var item2 = adFactory.CreateAd(type); checkout.Add(item1); checkout.Add(item2); var total = checkout.Total(); Assert.Equal(expected, total); }
// Starts up the SDK with the given appId private void Initialize(string appId) { VungleSDKConfig config = new VungleSDKConfig(); if (Vungle.minimumDiskSpaceForInitialization.HasValue) { config.SetMinimumDiskSpaceForInit(Vungle.minimumDiskSpaceForInitialization.Value); } if (Vungle.minimumDiskSpaceForAd.HasValue) { config.SetMinimumDiskSpaceForAd(Vungle.minimumDiskSpaceForAd.Value); } if (Vungle.enableHardwareIdPrivacy.HasValue) { config.SetDisableAshwidTracking(Vungle.enableHardwareIdPrivacy.Value); } config.SetPluginName("unity"); config.SetPluginVersion(Vungle.PluginVersion); config.SetApiEndpoint(new Uri(endpoint)); sdk = AdFactory.GetInstance(appId, config); sdk.AddOnEvent(VungleManager.OnEvent); VungleSceneLoom.Initialize(); }
public void UpdateCCPAStatus(Vungle.Consent status) { AdFactory.UpdateCCPAStatus((int)status); }
public void initializeSDK() { vungleProvider = AdFactory.GetInstance(appID); // From a core integration inmobiProvider = AdFactory.GetInstance(appID); // Simulate the handler that InMobi will reflect and attach itself to }
static void Main(string[] args) { /* * Ad ad1 = new Ad() { Price = 100 }; * Ad ad2 = new Ad() { Price = 23 }; * Ad ad3 = new Ad() { Price = 400 }; * Ad ad4 = new Ad() { Price = 1240 }; */ /* * var basicBuilder = new BasicAdBuilder(); * * var factory = new AdFactory(); * var builders = new List<AdBuilder> * { * basicBuilder * }; * * foreach (var b in builders) * { * var a = factory.Build(b); * Console.WriteLine(a.GetPrice()); * * } */ AdBuilder adBuilder1, adBuilder2, adBuilder3, adBuilder4; AssemblyLine assemblyLine = new AssemblyLine(); adBuilder1 = new AdFactory(); assemblyLine.Assemble(adBuilder1); adBuilder1.AddName("This is the name"); adBuilder1.AddDescription("this is the description"); adBuilder1.AddPrice("123"); adBuilder1.AddRating("3.4"); adBuilder1.Ad.Show(); var ad1 = adBuilder1.GetAd(); adBuilder2 = new AdFactory(); assemblyLine.Assemble(adBuilder2); adBuilder2.AddName("This is the name"); adBuilder2.AddDescription("this is the description"); adBuilder2.AddPrice("123"); adBuilder2.AddRating("3.4"); adBuilder2.Ad.Show(); var ad2 = adBuilder2.GetAd(); adBuilder3 = new AdFactory(); assemblyLine.Assemble(adBuilder3); adBuilder3.AddName("This is the name"); adBuilder3.AddDescription("this is the description"); adBuilder3.AddPrice("123"); adBuilder3.AddRating("3.4"); adBuilder3.Ad.Show(); var ad3 = adBuilder3.GetAd(); adBuilder4 = new AdFactory(); assemblyLine.Assemble(adBuilder4); adBuilder4.AddDescription("this is the description"); adBuilder4.AddName("This is the name"); adBuilder4.AddPrice("123"); adBuilder4.AddRating("444"); adBuilder4.Ad.Show(); var ad4 = adBuilder4.GetAd(); UserFactory userFactory = new UserFactory(); User user = userFactory.GetUser("Customer", "*****@*****.**"); Basket basket = new Basket(); basket.AddAd(ad2); basket.AddAd(ad4); Basket basket2 = new Basket(); basket.AddAd(ad1); basket.AddAd(ad3); basket.AddAd(basket2); user.Item = basket; user.Order(); Console.ReadLine(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { #if WIN10 if (sdkInstance == null && GameGlobal.IsShowVideoAds && IsConnectedToInternet()) { //sdkInstance = AdFactory.GetInstance("vungleTest"); sdkInstance = AdFactory.GetInstance("565f4a8bd0ed15880f00004c"); sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged; } else { progressRing.IsActive = false; } if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync(); } progressRing.IsActive = false; var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(7); timer.Tick += delegate { if (progressRing.IsActive && GameGlobal.IsShowVideoAds) { progressRing.IsActive = false; timer.Stop(); } }; timer.Start(); Frame rootFrame = Window.Current.Content as Frame; string myPages = ""; foreach (PageStackEntry page in rootFrame.BackStack) { myPages += page.SourcePageType.ToString() + "\n"; } if (rootFrame.CanGoBack) { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } #endif //IsGallery = string.Empty; //string[] parameters = e.Parameter.ToString().Split(','); //string sCategory = parameters[0]; //IsGallery = sCategory == "-1" ? parameters[1] : string.Empty; //mImages.Clear(); //if (string.IsNullOrEmpty(IsGallery)) //{ #if WIN10 string[] dirs = DirectoryGetFiles("Masha"); foreach (string dir in dirs) { mImages.Add(new ImageEntity { ImageSource = new BitmapImage(new Uri("ms-appx:///" + dir, UriKind.RelativeOrAbsolute)) }); } #endif #if WIN8_1 progressRing.IsActive = false; string category = "Masha"; var dirs = DirectoryGetFiles(category); foreach (var dir in dirs) { mImages.Add(new ImageEntity { ImageSource = new BitmapImage(new Uri("ms-appx:///Res\\Image\\" + category + "\\" + dir.Name, UriKind.RelativeOrAbsolute)) }); } #endif //} //else //{ // mImages.Add(new ImageEntity { ImageSource = GameGlobal.PictrueSource }); //} }