Exemplo n.º 1
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 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);
        }
 public void AddTemplates()
 {
     templatesStorage.Add(template1);
     templatesStorage.Add(template2);
 }