public void GetPriceWindowsTest()
        {
            IPriceCostRepository pricesNcosts = new PriceCostRepository();
            BlueprintPriceReport report       = reporter.GeneratePriceReport(toReport);
            float expectedResult = 150;
            float actualResult   = report.GetTotalPrice(ComponentType.WINDOW);

            Assert.AreEqual(expectedResult, actualResult);
        }
        public ManageCostsView(LoggedInView aControl, Session aSession)
        {
            InitializeComponent();
            parent  = aControl;
            current = aSession;
            IPriceCostRepository catalog = new PriceCostRepository();

            costsNprices = new CostsAndPricesManager(current, catalog);
            costPriceInfo.Hide();
        }
        private void GenerateTestData()
        {
            IUserRepository   users          = new UserRepository();
            SessionConnector  connector      = new SessionConnector();
            Session           fakeSession    = connector.LogIn("admin", "admin", users);
            UserAdministrator uAdministrator = new UserAdministrator(fakeSession, (IRepository <User>)users);
            Client            c1             = new Client("Enzo", "Ferreira", "testClient1", "password", "9595-01-73", "Colonia Ofir 7763", "4.435.511-2", DateTime.Now);
            Client            c2             = new Client("Camila", "Pinto", "testClient2", "password", "9780-93-03", "Florianapolis 7256", "2.817.601-3", DateTime.Now);
            Client            c3             = new Client("Isabelle", "Gomes", "testClient3", "password", "9610-94-47", "Colombes 1092", "1.429.972-1", DateTime.Now);
            Designer          d1             = new Designer("Fabrizio ", "Ferrari", "testDesigner1", "password", DateTime.Now);
            Designer          d2             = new Designer("Nazzareno ", "Iadanza", "testDesigner2", "password", DateTime.Now);
            Architect         archy          = new Architect("Gustave", "Eiffel", "testArchitect1", "password", DateTime.Now);

            uAdministrator.Add(archy);
            uAdministrator.Add(c1);
            uAdministrator.Add(c2);
            uAdministrator.Add(c3);
            uAdministrator.Add(d1);
            uAdministrator.Add(d2);
            fakeSession = connector.LogIn("testDesigner1", "password", users);
            IRepository <IBlueprint> bpStorage    = new BlueprintRepository();
            BlueprintController      bpController = new BlueprintController(fakeSession, bpStorage);
            Blueprint bp1 = new Blueprint(8, 8, "Mi tablero de ajedrez gigante");

            bp1.InsertWall(new Logic.Domain.Point(1, 1), new Logic.Domain.Point(1, 5));
            bp1.InsertWall(new Logic.Domain.Point(2, 2), new Logic.Domain.Point(5, 2));
            bp1.Sign(archy);
            bp1.Owner = c1;
            Blueprint bp2 = new Blueprint(10, 10, "oficina nueva");

            bp2.InsertWall(new Logic.Domain.Point(3, 3), new Logic.Domain.Point(3, 1));
            bp2.InsertWall(new Logic.Domain.Point(1, 1), new Logic.Domain.Point(1, 5));
            bp2.Owner = c2;
            Blueprint bp3 = new Blueprint(6, 5, "Barbacoa en el fondo");

            bp3.InsertWall(new Logic.Domain.Point(2, 2), new Logic.Domain.Point(5, 2));
            bp3.InsertWall(new Logic.Domain.Point(3, 3), new Logic.Domain.Point(3, 1));
            bp3.Owner = c2;
            bpController.Add(bp1);
            bpController.Add(bp2);
            bpController.Add(bp3);
            IPriceCostRepository prices = new PriceCostRepository();

            prices.AddCostPrice((int)ComponentType.WALL, 50, 100);
            prices.AddCostPrice((int)ComponentType.BEAM, 50, 100);
            prices.AddCostPrice((int)ComponentType.DOOR, 50, 100);
            prices.AddCostPrice((int)ComponentType.WINDOW, 50, 75);
            prices.AddCostPrice((int)ComponentType.COLUMN, 25, 50);
        }
        public void SetUp()
        {
            connector = new SessionConnector();
            IUserRepository users    = new UserRepository();
            Session         aSession = connector.LogIn("admin", "admin", users);

            storage      = new PriceCostRepository();
            costsNPrices = new CostsAndPricesManager(aSession, storage);
            IPriceCostRepository pricesNcosts = new PriceCostRepository();

            reporter = new BlueprintReportGenerator(pricesNcosts);
            toReport = new Blueprint(10, 10, "TestBlueprint");
            SetBlueprint();
            AddPrices();
        }
        //Auxiliar
        private void calulateCostsAndPrices()
        {
            IPriceCostRepository     pricesNcosts    = new PriceCostRepository();
            BlueprintReportGenerator reportGenerator = new BlueprintReportGenerator(pricesNcosts);
            BlueprintCostReport      costReport      = reportGenerator.GenerateCostReport(selectedBluePrint);
            BlueprintPriceReport     priceReport     = reportGenerator.GeneratePriceReport(selectedBluePrint);

            if (CurrentSession.UserLogged.HasPermission(Permission.VIEW_COSTS))
            {
                lblWallsTotalCost.Text   = costReport.GetTotalCost(ComponentType.WALL) + "";
                lblBeamsTotalCost.Text   = costReport.GetTotalCost(ComponentType.BEAM) + "";
                lblDoorsTotalCost.Text   = costReport.GetTotalCost(ComponentType.DOOR) + "";
                lblWindowsTotalCost.Text = costReport.GetTotalCost(ComponentType.WINDOW) + "";
                lblColumnsTotalCost.Text = costReport.GetTotalCost(ComponentType.COLUMN) + "";
                lblTotalCostSum.Text     = (costReport.GetTotalCost(ComponentType.WALL) + costReport.GetTotalCost(ComponentType.BEAM) + costReport.GetTotalCost(ComponentType.DOOR) + costReport.GetTotalCost(ComponentType.WINDOW)) + costReport.GetTotalCost(ComponentType.COLUMN) + "";
            }

            lblWallsPrice.Text        = priceReport.GetTotalPrice(ComponentType.WALL) + "";
            lblBeamsPrice.Text        = priceReport.GetTotalPrice(ComponentType.BEAM) + "";
            lblDoorsPrice.Text        = priceReport.GetTotalPrice(ComponentType.DOOR) + "";
            lblWindowsPrice.Text      = priceReport.GetTotalPrice(ComponentType.WINDOW) + "";
            lblColumnsTotalPrice.Text = priceReport.GetTotalPrice(ComponentType.COLUMN) + "";
            lblTotalPriceSum.Text     = (priceReport.GetTotalPrice(ComponentType.WALL) + priceReport.GetTotalPrice(ComponentType.BEAM) + priceReport.GetTotalPrice(ComponentType.DOOR) + priceReport.GetTotalPrice(ComponentType.WINDOW)) + priceReport.GetTotalPrice(ComponentType.COLUMN) + "";
        }