Exemplo n.º 1
0
        public void Creates_page()
        {
            var normalElement = new NullElement();

            WebDriver.Expect(".something", new NullElement());
            WebDriver.Expect("#id", normalElement);

            var simple = new NullElement();

            normalElement.Expect(".simplePart", simple);
            normalElement.Expect(".normal", new NullElement());

            simple.Expect(".byClass", new NullElement());
            simple.Expect("a", new NullElement(), new NullElement(), new NullElement());

            var page = GetPage <NormalPage>();

            Assert.IsNotNull(page.GetElement());

            var normal = page.Normal;

            Assert.IsNotNull(normal, "normal");
            Assert.IsNotNull(normal.GetElement());

            HasPartPageTests.VerifySimple(normal.Simple);
        }
Exemplo n.º 2
0
        public void Creates_page()
        {
            var widgets = new NullElement();

            WebDriver.Expect("#widgets", widgets);

            var items = new[] {
                new NullElement(),
                new NullElement(),
                new NullElement()
            };

            widgets.Expect(".widget", items);

            foreach (var item in items)
            {
                item.Expect("h3", new NullElement());
                item.Expect("p", new NullElement());
                item.Expect("div.image", new NullElement());
            }

            var page = GetPage <NormalListPage>();

            Assert.IsNotNull(page);
            Assert.IsNotNull(page.Container);
            Assert.IsNotNull(page.Container.Items);

            foreach (var item in page.Container.Items)
            {
                Assert.IsNotNull(item.GetTitle());
                Assert.IsNotNull(item.GetDescription());
                Assert.IsNotNull(item.GetImage());
            }
        }
Exemplo n.º 3
0
        public void UpdateTheDataInputCurrentValue()
        {
            var output   = new DataOutput("a");
            var element1 = new NullElement();

            element1.Outputs.Add(output);

            var input    = new DataInput("a");
            var element2 = new NullElement();

            element2.Inputs.Add(input);

            var model = ProcessModel.Create()
                        .AddNullElement("element1", element1)
                        .AddNullElement("element2", element2)
                        .AddDataAssociation("assoc", DataAssociation.Create("element1", "a", "element2", "a"));

            var models = new InMemoryProcessModelsStore();

            models.Store(model);

            var manager = new ProcessManager(
                models,
                new InMemoryProcessInstancesStore()
                );

            var instance = ProcessInstance.Create(model);

            manager.Attach(instance);

            var context = new ExecutionContext(manager, model, instance, instance.Token, null);

            output.Update(context, "element1", "Hello World");
            input.GetCurrentValue(context, "element2").Should().Be("Hello World");
        }
Exemplo n.º 4
0
        public void Creates_page()
        {
            var simple = new NullElement();

            WebDriver.Expect(".simplePart", simple);

            simple.Expect(".byClass", new NullElement());
            simple.Expect("a", new NullElement());

            var page = GetPage <HasPartPage>();

            VerifySimple(page.Simple);
        }
        VisitStatus IVisitAdapter.Visit <TProperty, TContainer, TValue>(
            IPropertyVisitor visitor,
            TProperty property,
            ref TContainer container,
            ref TValue value,
            ref ChangeTracker changeTracker)
        {
            if (null != value)
            {
                return(VisitStatus.Unhandled);
            }

            var nullElement = new NullElement <TValue>(property.GetName());

            VisitorContext.Parent.contentContainer.Add(nullElement);
            return(VisitStatus.Override);
        }
        public VisitStatus BeginCollection <TProperty, TContainer, TValue>(
            IPropertyVisitor visitor,
            TProperty property,
            ref TContainer container,
            ref TValue value,
            ref ChangeTracker changeTracker)
            where TProperty : ICollectionProperty <TContainer, TValue>
        {
            if (null != value)
            {
                return(VisitStatus.Unhandled);
            }

            var nullElement = new NullElement <TValue>(property.GetName());

            VisitorContext.Parent.contentContainer.Add(nullElement);
            return(VisitStatus.Override);
        }
Exemplo n.º 7
0
        public static Element GetElementFromObject(object model)
        {
            Element element = null;

            if (model == null)
            {
                element = new NullElement();
            }
            else
            {
                var type = model.GetType();

                if (Array.IndexOf(Constants.NumberTypes, type) >= 0)
                {
                    element = new NumberElement();
                }
                else if (Array.IndexOf(Constants.StringTypes, type) >= 0)
                {
                    element = new StringElement();
                }
                else if (Array.IndexOf(Constants.BooleanTypes, type) >= 0)
                {
                    element = new BooleanElement();
                }
                else if (typeof(IEnumerable).IsAssignableFrom(type))
                {
                    element = new ArrayElement();
                }
                else
                {
                    element = new ObjectElement();
                }

                element.PopulateElement(model);
            }

            return(element);
        }
Exemplo n.º 8
0
        public void Waits_for_element_on_part()
        {
            WebDriver
            .Expect("#wait-for", new NullElement())
            .ReturnAfter(5.Attempt());

            var part = new NullElement();

            WebDriver.Expect("#waitable", part);

            part.Expect(".cool", new NullElement());
            part.Expect("#something", new NullElement())
            .ReturnAfter(3.Attempt());

            var page = GetPage <WaitPage>();

            Assert.IsNotNull(page);
            Assert.IsNotNull(page.Waitable);

            var expectation = part.Verify("#something");

            Assert.IsTrue(expectation.WasReturned(), $"Attemps: {expectation.Requests}.");
        }
Exemplo n.º 9
0
        //POSTAC: 5
        //PUDELKO:6
        //PODLOGA:3
        //SCIANA:2
        //PUNKT:4
        void initMap(string pathFileMap)
        {
            this.Controls.Add(cbStart);
            cbStart.Show();
            this.Controls.Add(startScreen[mapNumber - 1]);
            startScreen[mapNumber - 1].Show();
            initButtons();
            PointsList = null;

            numberSteps = 0;
            numberShiftsBoxes = 0;

            previousnumberShiftsBoxes = 0;
            previousNumberSteps = 0;

            SetBoxes = 0;
            posX = 0;
            posY = 0;
            initLabels();

            readNumbers = readFile(pathFileMap);
            Map = new List<List<MapObject>>();
            PointsList = findPositionPoints(readNumbers);

            for (int i = 0; i < readNumbers.Count(); i++)
            {

                List<MapObject> initList = new List<MapObject>();

                for (int j = 0; j < readNumbers[i].Count(); j++)
                {

                    if (readNumbers[i][j] == 5)
                    {
                        Hero newHero = new Hero(heightElement, widthElement, posX, posY);
                        initList.Add(newHero);
                        this.Controls.Add(newHero.picturebox);
                    }

                    if (readNumbers[i][j] == 6)
                    {
                        Box newBox = new Box(heightElement, widthElement, posX, posY);
                        initList.Add(newBox);
                        this.Controls.Add(newBox.picturebox);
                    }

                    if (readNumbers[i][j] == 1)
                    {
                        NullElement newNullElement = new NullElement();
                        initList.Add(newNullElement);

                    }

                    if (readNumbers[i][j] == 2)
                    {
                        Wall newWall = new Wall(heightElement, widthElement, posX, posY);
                        initList.Add(newWall);
                        this.Controls.Add(newWall.picturebox);
                    }

                    if (readNumbers[i][j] == 4)
                    {
                        EndPoint newEndPoint = new EndPoint(heightElement, widthElement, posX, posY);
                        initList.Add(newEndPoint);
                        this.Controls.Add(newEndPoint.picturebox);
                    }

                    if (readNumbers[i][j] == 3)
                    {

                        Floor newFloor = new Floor(heightElement, widthElement, posX, posY);
                        initList.Add(newFloor);
                        this.Controls.Add(newFloor.picturebox);
                    }

                    posX = posX + 64;

                }
                posY = posY + 64;
                posX = posX - (64 * initList.Count());

                Map.Add(initList);
            }

            timer = new System.Timers.Timer(100);
            timer.Elapsed += (s, e) => UpdateTime(e);
        }
Exemplo n.º 10
0
        //POSTAC: 5
        //PUDELKO:6
        //PODLOGA:3
        //SCIANA:2
        //PUNKT:4
        void initMap(string pathFileMap)
        {
            this.Controls.Add(cbStart);
            cbStart.Show();
            this.Controls.Add(startScreen[mapNumber - 1]);
            startScreen[mapNumber - 1].Show();
            initButtons();
            PointsList = null;

            numberSteps       = 0;
            numberShiftsBoxes = 0;

            previousnumberShiftsBoxes = 0;
            previousNumberSteps       = 0;

            SetBoxes = 0;
            posX     = 0;
            posY     = 0;
            initLabels();

            readNumbers = readFile(pathFileMap);
            Map         = new List <List <MapObject> >();
            PointsList  = findPositionPoints(readNumbers);

            for (int i = 0; i < readNumbers.Count(); i++)
            {
                List <MapObject> initList = new List <MapObject>();

                for (int j = 0; j < readNumbers[i].Count(); j++)
                {
                    if (readNumbers[i][j] == 5)
                    {
                        Hero newHero = new Hero(heightElement, widthElement, posX, posY);
                        initList.Add(newHero);
                        this.Controls.Add(newHero.picturebox);
                    }


                    if (readNumbers[i][j] == 6)
                    {
                        Box newBox = new Box(heightElement, widthElement, posX, posY);
                        initList.Add(newBox);
                        this.Controls.Add(newBox.picturebox);
                    }


                    if (readNumbers[i][j] == 1)
                    {
                        NullElement newNullElement = new NullElement();
                        initList.Add(newNullElement);
                    }


                    if (readNumbers[i][j] == 2)
                    {
                        Wall newWall = new Wall(heightElement, widthElement, posX, posY);
                        initList.Add(newWall);
                        this.Controls.Add(newWall.picturebox);
                    }


                    if (readNumbers[i][j] == 4)
                    {
                        EndPoint newEndPoint = new EndPoint(heightElement, widthElement, posX, posY);
                        initList.Add(newEndPoint);
                        this.Controls.Add(newEndPoint.picturebox);
                    }


                    if (readNumbers[i][j] == 3)
                    {
                        Floor newFloor = new Floor(heightElement, widthElement, posX, posY);
                        initList.Add(newFloor);
                        this.Controls.Add(newFloor.picturebox);
                    }

                    posX = posX + 64;
                }
                posY = posY + 64;
                posX = posX - (64 * initList.Count());

                Map.Add(initList);
            }

            timer          = new System.Timers.Timer(100);
            timer.Elapsed += (s, e) => UpdateTime(e);
        }