public void SetUp()
 {
     templatesStorage = new OpeningTemplateRepository();
     templatesStorage.Clear();
     template1 = new Template("Gate", 2, 0, 2, ComponentType.DOOR);
     template2 = new Template("Hopper", 1, 1, 1, ComponentType.WINDOW);
 }
        public void ConstructorTest()
        {
            Session session = conn.LogIn("designer3", "12345", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          blueEditor       = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            Assert.IsNotNull(blueEditor);
        }
        private BlueprintEditor GetInstance()
        {
            Session session = conn.LogIn("designer3", "12345", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          newInstance      = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            return(newInstance);
        }
        public void GetOpeningTemplatesTest()
        {
            initializerWithData();
            Session session = conn.LogIn("architect", "architect", (IUserRepository)repository);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          editor           = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);
            ICollection <Template>   templates        = editor.GetTemplates();

            Assert.IsNotNull(templates);
        }
        public void SignBlueprintTest()
        {
            IUserRepository          users            = new UserRepository();
            Session                  session          = conn.LogIn("architect", "architect", users);
            IRepository <IBlueprint> bpStorage        = new BlueprintRepository();
            IRepository <Template>   templatesStorage = new OpeningTemplateRepository();
            BlueprintEditor          blueEditor       = new BlueprintEditor(session, blueprintTest, bpStorage, templatesStorage);

            blueEditor.Sign();
            Assert.AreEqual(1, blueprintTest.GetSignatures().Count);
        }
示例#6
0
 private void CreateTemplateAndSave()
 {
     //the purpose of dataOk is the in-field message displays
     if (DataOk())
     {
         string   tempName         = nameText.Text;
         float    length           = (float)spinnerLength.Value;
         float    height           = (float)spinnerHeight.Value;
         float    heightAboveFloor = (float)spinnerHeightAboveFloor.Value;
         Template created          = new Template(tempName, length, heightAboveFloor, height, typeCreated);
         IRepository <Template> templateStorage = new OpeningTemplateRepository();
         templateStorage.Add(created);
         mother.GoToMenu();
     }
 }
        public void BuildTestBlueprint()
        {
            IRepository <Template> tempStorage = new OpeningTemplateRepository();

            tempStorage.Clear();
            Template gate = new Template("Gate", 2, 0, 2, ComponentType.DOOR);

            tempStorage.Add(gate);
            Opening gateOp      = new Door(new Point(1, 1), gate);
            Opening otherGateOp = new Door(new Point(2, 2), gate);

            blueprint1.InsertColumn(new Point(2, 3));

            blueprint1.InsertWall(new Point(0, 2), new Point(4, 2));
            blueprint1.InsertWall(new Point(0, 1), new Point(4, 1));

            blueprint1.InsertOpening(gateOp);
            blueprint1.InsertOpening(otherGateOp);
        }
        public EditBlueprintView(Session aSession, LoggedInView aParent, Blueprint aBlueprint)
        {
            InitializeComponent();

            CurrentSession                 = aSession;
            parent                         = aParent;
            selectedBluePrint              = aBlueprint;
            parent.ParentForm.FormClosing += new FormClosingEventHandler(CheckSignmentEventHandler);

            BlueprintPanel.Cursor = Cursors.Cross;
            IRepository <IBlueprint> bpStorage           = new BlueprintRepository();
            IRepository <Template>   templatesRepository = new OpeningTemplateRepository();

            editor = new BlueprintEditor(aSession, aBlueprint, bpStorage, templatesRepository);
            IRepository <Template> templates = new OpeningTemplateRepository();

            openingFactory = new OpeningFactory(templates);


            int gridLinesMarginToLayerInPixels    = 1;
            int drawSurfaceMarginToWindowInPixels = 10;
            int gridCellCountX         = aBlueprint.Length;
            int gridCellCountY         = aBlueprint.Width;
            int windowXBoundryInPixels = this.BlueprintPanel.Width;
            int windowYBoundryInPixels = this.BlueprintPanel.Height;

            drawer = new Drawer(gridCellCountX, gridCellCountY, 40, windowXBoundryInPixels, windowYBoundryInPixels, gridLinesMarginToLayerInPixels, drawSurfaceMarginToWindowInPixels);
            LoadGridPaintStrategies();
            setUpDrawSurface(40);

            PaintWalls();
            PaintBeams();
            PaintOpenings();
            PaintColumns();
            calulateCostsAndPrices();
            ShowOrHideSignButton();
            ShowOrHideTools();

            ICollection <Template> templatesInDB = editor.GetTemplates();

            cmbTemplates.DataSource = templatesInDB;
        }
        public void OpeningsPersistenceCountTest()
        {
            IRepository <Template> tempStorage = new OpeningTemplateRepository();

            tempStorage.Clear();
            Template gate = new Template("Gate", 2, 0, 2, ComponentType.DOOR);

            tempStorage.Add(gate);
            Opening gateOp      = new Door(new Point(1, 1), gate);
            Opening otherGateOp = new Door(new Point(2, 2), gate);

            blueprint1.InsertWall(new Point(0, 2), new Point(4, 2));
            blueprint1.InsertWall(new Point(0, 1), new Point(4, 1));
            blueprint1.InsertOpening(gateOp);
            blueprint1.InsertOpening(otherGateOp);
            portfolio.Add(blueprint1);
            IBlueprint retrieved      = portfolio.Get(blueprint1.GetId());
            int        expectedResult = 2;
            int        actualResult   = retrieved.GetWalls().Count;

            Assert.AreEqual(expectedResult, actualResult);
        }