Ejemplo n.º 1
0
        public void Run()
        {
            descriptionRichTextBox = df.descriptionRichTextBox;
            iTestForm = df;

            ShowDescriptionDialog(true);

            if (!navigator.HasNextSet)
            {
                throw new EndTestException("Test has no sets of questions.");
            }

            GetNextSet();
            ShowDescriptionDialog(false);
            if (!navigator.HasNextQuestion)
            {
                throw new EndTestException("Set of questions has no questions.");
            }

            if (isPractice)
            {
                practiceForm = new PracticeForm(this);
                iTestForm    = practiceForm;
                practiceForm.Show();
            }
            else
            {
                testForm  = new TestForm(this);
                iTestForm = testForm;
                testForm.Show();
            }
        }
Ejemplo n.º 2
0
        public TestPresenter(ITestForm view, ITestManager manager, IMessageService messageService)
        {
            _view           = view;
            _manager        = manager;
            _messageService = messageService;

            _view.StartTestClick    += _view_StartTestClick;
            _view.NextQuestionClick += _view_NextQuestionClick;
        }
 public FormTests()
 {
     CalculatorForm = new CalculatorForm();
     TestForm       = new TestForm(Locator, PageName);
 }
Ejemplo n.º 4
0
        public void CreateSyntax()
        {
            var form = New.Form(new { Misc = 4 })
                       .Actions(New.Fieldset()
                                .Save(New.Button().Value("Save").Id("Hello"))
                                .Cancel(New.Button().Value("Cancel")));


            var bar = New.Foo(new { Bleah = (object)null });

            Assert.That(bar.Bleah(), Is.SameAs(Nil.Instance));
            Assert.That(bar.Bleah, Is.SameAs(Nil.Instance));
            Assert.That(bar.Yarg, Is.SameAs(Nil.Instance));
            Assert.That(bar.One.Two.Three()["Four"], Is.SameAs(Nil.Instance));

            var    foo1 = bar.Foo;
            string foo2 = bar.Foo;
            int?   foo3 = bar.Foo;
            var    foo4 = bar.Foo == null;
            var    foo5 = bar.Foo != null;
            var    foo6 = (ITest)bar.Foo;
            var    foo7 = (string)bar.Foo ?? "yarg";

            //            var foo8 = bar.Foo ? bar.Foo : (dynamic)"yarg";


            Assert.That(foo1, Is.SameAs(Nil.Instance));
            Assert.That(foo2, Is.Null);
            Assert.That(foo3, Is.Null);
            Assert.That(foo4, Is.True);
            Assert.That(foo5, Is.False);
            Assert.That(foo6, Is.Not.Null);
            Assert.That(foo7, Is.EqualTo("yarg"));
            //Assert.That(foo8, Is.EqualTo("yarg"));

            //            form.Actions += bar;

            form.Misc += 3;

            Assert.That(form.ShapeName, Is.EqualTo("Form"));
            Assert.That(form.Misc, Is.EqualTo(7));
            Assert.That(form.Actions.Save.Id, Is.EqualTo("Hello"));
            Assert.That(form.Actions.Save.Value, Is.EqualTo("Save"));
            Assert.That(form.Actions.Cancel.Value, Is.EqualTo("Cancel"));

            Assert.That(form.Misc(), Is.EqualTo(7));
            Assert.That(form.Actions().Save().Id(), Is.EqualTo("Hello"));
            Assert.That(form.Actions().Save().Value(), Is.EqualTo("Save"));
            Assert.That(form.Actions().Cancel().Value(), Is.EqualTo("Cancel"));

            form[3] = "hello";

            Assert.That(form["Misc"], Is.EqualTo(7));
            Assert.That(form["Actions"]["Save"]["Id"], Is.EqualTo("Hello"));
            Assert.That(form["Actions"]["Save"]["Value"], Is.EqualTo("Save"));
            Assert.That(form["Actions"]["Cancel"]["Value"], Is.EqualTo("Cancel"));

            ITestForm f = form;

            Assert.That(f.Misc, Is.EqualTo(7));
            Assert.That(f.Actions.ShapeName, Is.EqualTo("Fieldset"));
            Assert.That(f.Actions.Save.Id, Is.EqualTo("Hello"));
            Assert.That(f.Actions.Save.Value, Is.EqualTo("Save"));
            Assert.That(f.Actions.Cancel.Value, Is.EqualTo("Cancel"));
            Assert.That(f.Actions.Preview.Id, Is.Null);
            Assert.That((dynamic)f.Actions.Preview == null);

            Assert.That(f["Misc"], Is.EqualTo(7));
            f["Misc"] = 4;
            Assert.That(f.Misc, Is.EqualTo(4));
            Assert.That(f["Misc"], Is.EqualTo(4));
            Assert.That(form.Misc, Is.EqualTo(4));

            f.Misc = 9;
            Assert.That(f.Misc, Is.EqualTo(9));
            Assert.That(f["Misc"], Is.EqualTo(9));
            Assert.That(form.Misc, Is.EqualTo(9));
        }
Ejemplo n.º 5
0
 public CachedFormTests()
 {
     CalculatorForm = new CalculatorFormWithCachedElements();
     TestForm       = new TestForm(Locator, PageName);
 }
Ejemplo n.º 6
0
 public CachedWindowTests()
 {
     CalculatorForm = new CalculatorWindowWithCachedElements();
     TestForm       = new TestWindow(Locator, PageName);
 }