Ejemplo n.º 1
0
    public void check_get_active_campaign_without_empty_list(String campaign1, String campaign2)
    {
        PoolManager poolManager = new PoolManager();

        String[] sCamp         = campaign1.Split(" ");
        String[] sCamp2        = campaign2.Split(" ");
        Campaign campaignTemp1 = new Campaign(sCamp[1], sCamp[2],
                                              Double.Parse(sCamp[3]), Double.Parse(sCamp[4]), Double.Parse(sCamp[5]));
        Campaign campaignTemp2 = new Campaign(sCamp[1], sCamp[2],
                                              Double.Parse(sCamp[3]), Double.Parse(sCamp[4]), Double.Parse(sCamp[5]));

        campaignTemp1._campaignStatus = CampaignStatus.Ended;
        poolManager.getCampaigns().Add(campaignTemp1);
        poolManager.getCampaigns().Add(campaignTemp2);
        Assert.Equal(1, (int)campaignController.getActiveCampaign(poolManager).Count);
    }
Ejemplo n.º 2
0
    public void check_get_product_in_active_campaign(String product1, String product2, String product3,
                                                     String campaign1, String campaign2, String campaign3)
    {
        CampaignController campaignController = new CampaignController();
        PoolManager        poolManager        = new PoolManager();

        String[] sPro1         = product1.Split(" ");
        String[] sPro2         = product2.Split(" ");
        String[] sPro3         = product3.Split(" ");
        String[] sCamp1        = campaign1.Split(" ");
        String[] sCamp2        = campaign2.Split(" ");
        String[] sCamp3        = campaign3.Split(" ");
        Product  productTemp1  = new Product(sPro1[1], Double.Parse(sPro1[2]), Double.Parse(sPro1[3]), false);
        Product  productTemp2  = new Product(sPro2[1], Double.Parse(sPro2[2]), Double.Parse(sPro2[3]), false);
        Product  productTemp3  = new Product(sPro3[1], Double.Parse(sPro3[2]), Double.Parse(sPro3[3]), false);
        Campaign campaignTemp1 = new Campaign(sCamp1[1], sCamp1[2],
                                              Double.Parse(sCamp1[3]), Double.Parse(sCamp1[4]), Double.Parse(sCamp1[5]));
        Campaign campaignTemp2 = new Campaign(sCamp2[1], sCamp2[2],
                                              Double.Parse(sCamp2[3]), Double.Parse(sCamp2[4]), Double.Parse(sCamp2[5]));
        Campaign campaignTemp3 = new Campaign(sCamp3[1], sCamp3[2],
                                              Double.Parse(sCamp3[3]), Double.Parse(sCamp3[4]), Double.Parse(sCamp3[5]));

        poolManager.getProducts().Add(productTemp1);
        poolManager.getProducts().Add(productTemp2);
        poolManager.getProducts().Add(productTemp3);
        campaignTemp1._campaignStatus = CampaignStatus.Active;
        campaignTemp3._campaignStatus = CampaignStatus.Active;
        campaignTemp2._campaignStatus = CampaignStatus.Ended;
        poolManager.getCampaigns().Add(campaignTemp1);
        poolManager.getCampaigns().Add(campaignTemp2);
        poolManager.getCampaigns().Add(campaignTemp3);
        Assert.Equal(2,
                     (int)(productController.getProductinActiveCampaign(campaignController.getActiveCampaign(poolManager), poolManager)).Count);
    }