Example #1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Console.SetOut(_logSaver);
            SetUpFixture.SetUp();

            // create a new window instance based on the screen size
            _window = new UIWindow(UIScreen.MainScreen.Bounds);
            _runner = new NonterminatingTouchRunner(_window, _logSaver);

            // register every tests included in the main application/assembly
            _runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
            _runner.AutoStart = true;
            _runner.TerminateAfterExecution = true;

            _window.RootViewController = new UINavigationController(_runner.GetViewController());

            // make the window visible
            _window.MakeKeyAndVisible();

            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            return(true);
        }
		public Test BuildFrom(Type type)
		{
			SetUpFixture fixture = new SetUpFixture( type );

            string reason = null;
            if (!IsValidFixtureType(type, ref reason))
            {
                fixture.RunState = RunState.NotRunnable;
                fixture.IgnoreReason = reason;
            }

            return fixture;
		}
Example #3
0
        public Test BuildFrom(Type type)
        {
            SetUpFixture fixture = new SetUpFixture(type);

            string reason = null;

            if (!IsValidFixtureType(type, ref reason))
            {
                fixture.RunState     = RunState.NotRunnable;
                fixture.IgnoreReason = reason;
            }

            return(fixture);
        }
Example #4
0
        [Test] public void MethodIsInvokedForEachRow()
        {
            Parse table =
                Parse.ParseFrom("<table><tr><td></td></tr><tr><td>method</td></tr><tr><td>value</td></tr></table>");
            var cellOperation = new Mock <CellOperation>();
            var setUp         = new SetUpFixture {
                CellOperation = cellOperation.Object
            };

            setUp.DoTable(table);
            cellOperation.Verify(o => o.TryInvoke(setUp,
                                                  It.Is <Tree <Cell> >(c => c.Branches[0].Value.Text == "method"),
                                                  It.Is <Tree <Cell> >(c => c.Branches[0].Value.Text == "value"),
                                                  It.Is <Tree <Cell> >(c => c.Value.Text == "value")));
        }
Example #5
0
        /// <summary>
        /// Build a SetUpFixture from type provided. Normally called for a Type
        /// on which the attribute has been placed.
        /// </summary>
        /// <param name="typeInfo">The type info of the fixture to be used.</param>
        /// <returns>A SetUpFixture object as a TestSuite.</returns>
        public IEnumerable <TestSuite> BuildFrom(ITypeInfo typeInfo)
        {
            SetUpFixture fixture = new SetUpFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string reason = null;
                if (!IsValidFixtureType(typeInfo, ref reason))
                {
                    fixture.MakeInvalid(reason);
                }
            }

            return(new TestSuite[] { fixture });
        }
        [Test] public void MethodIsInvokedForEachRow()
        {
            Parse table =
                Parse.ParseFrom("<table><tr><td></td></tr><tr><td>method</td></tr><tr><td>value</td></tr></table>");
            var processor = new Mock <CellProcessor>();
            var setUp     = new SetUpFixture {
                Processor = processor.Object
            };

            setUp.DoTable(table);
            processor.Verify(o => o.Operate <ExecuteOperator>(setUp,
                                                              It.Is <Tree <Cell> >(c => c.ValueAt(0).Text == "method"),
                                                              It.Is <Tree <Cell> >(c => c.ValueAt(0).Text == "value"),
                                                              It.Is <Cell>(c => c.Text == "value")));
        }
Example #7
0
        /// <summary>
        /// Build a SetUpFixture from type provided. Normally called for a Type
        /// on which the attribute has been placed.
        /// </summary>
        /// <param name="type">The type of the fixture to be used.</param>
        /// <returns>A SetUpFixture object as a TestSuite.</returns>
        public IEnumerable <TestSuite> BuildFrom(Type type)
        {
            SetUpFixture fixture = new SetUpFixture(type);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string reason = null;
                if (!IsValidFixtureType(type, ref reason))
                {
                    fixture.RunState = RunState.NotRunnable;
                    fixture.Properties.Set(PropertyNames.SkipReason, reason);
                }
            }

            return(new TestSuite[] { fixture });
        }
Example #8
0
        /// <summary>
        /// Build a SetUpFixture from type provided. Normally called for a Type
        /// on which the attribute has been placed.
        /// </summary>
        /// <param name="typeInfo">The type info of the fixture to be used.</param>
        /// <returns>A SetUpFixture object as a TestSuite.</returns>
        public IEnumerable<TestSuite> BuildFrom(ITypeInfo typeInfo)
        {
            SetUpFixture fixture = new SetUpFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string reason = null;
                if (!IsValidFixtureType(typeInfo, ref reason))
                {
                    fixture.RunState = RunState.NotRunnable;
                    fixture.Properties.Set(PropertyNames.SkipReason, reason);
                }
            }

            return new TestSuite[] { fixture };
        }
        /// <summary>
        /// Build a SetUpFixture from type provided. Normally called for a Type
        /// on which the attribute has been placed.
        /// </summary>
        /// <param name="type">The type of the fixture to be used.</param>
        /// <returns>A SetUpFixture object as a TestSuite.</returns>
        public TestSuite BuildFrom(Type type)
        {
            SetUpFixture fixture = new SetUpFixture(type);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string reason = null;
                if (!IsValidFixtureType(type, ref reason))
                {
                    fixture.RunState = RunState.NotRunnable;
                    fixture.Properties.Set(PropertyNames.SkipReason, reason);
                }
            }

            return fixture;
        }
Example #10
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.SetOut(_logSaver);
            SetUpFixture.SetUp();

            AddTest(Assembly.GetExecutingAssembly());

            // to add tests in additional assemblies, uncomment/adapt the line below
            // AddTest (typeof (Your.Library.TestClass).Assembly);

            // there is currently an issue where the test runner blocks the UI thread.
            Intent.PutExtra("automated", true);

            // Once you called base.OnCreate(), you cannot add more assemblies.
            base.OnCreate(bundle);
        }
Example #11
0
        public IEnumerable <TestSuite> BuildFrom(ITypeInfo typeInfo)
        {
            SetUpFixture fixture = new SetUpFixture(typeInfo);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string?reason = null;
                if (!IsValidFixtureType(typeInfo, ref reason))
                {
                    fixture.MakeInvalid(reason);
                }
            }

            fixture.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo());

            return(new TestSuite[] { fixture });
        }
Example #12
0
        public TestSuite BuildFrom(ITypeInfo typeInfo)
        {
            var          setUpFixtureType = new DefaultNamespaceTypeWrapper(typeof(LuceneTestCase.SetUpFixture));
            SetUpFixture fixture          = new SetUpFixture(setUpFixtureType);

            if (fixture.RunState != RunState.NotRunnable)
            {
                string reason = null;
                if (!IsValidFixtureType(setUpFixtureType, ref reason))
                {
                    fixture.MakeInvalid(reason);
                }
            }

            fixture.ApplyAttributesToTest(setUpFixtureType.Type.GetTypeInfo());

            return(fixture);
        }