예제 #1
0
        private async Task CheckNavPage
        (
            LabPatternResultsAppModel appModel,
            LabPatternResultsTestDevice testDevice
        )
        {
            switch (appModel.NavState)
            {
            case NavState.OnMainPage:
                var mainPage = testDevice.Navigation.NavigationStack.Last() as MainPage;
                Assert.NotNull(mainPage);
                _mainPageChecker.Check(appModel.ExpectedMainPage, mainPage);
                break;

            case NavState.OnUomsPage:
                var uomsPage = testDevice.Navigation.NavigationStack.Last() as CollectionPage <Uom>;
                Assert.NotNull(uomsPage);
                await _uomsPageChecker.Check(appModel.ExpectedUomsCollectionPage, uomsPage);

                break;

            case NavState.OnUomItemPage:
                var uomItemPage = testDevice.Navigation.NavigationStack.Last() as UomItemPage;
                Assert.NotNull(uomItemPage);
                await _uomItemPageChecker.Check(appModel.ExpectedUomItemPage, uomItemPage);

                break;

            case NavState.Empty:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public LabResultPatternsTestUser GetTestUser
        (
            SqliteConnection deviceConnection,
            SqliteConnection modelConnection
        )
        {
            // Funcs<DbContext> for appModel and pageCheckManager
            PropertyContext GetDeviceContext()
            {
                return(GetPropertyContext(deviceConnection));
            }

            PropertyContext GetModelContext()
            {
                return(GetPropertyContext(modelConnection));
            }

            // create the AppModel
            var appModel = new LabPatternResultsAppModel(GetModelContext);

            // create the TestDevice
            var testDevice = new LabPatternResultsTestDevice();

            // create the PageChecker
            var pageCheckManager = new PageCheckManager(GetDeviceContext, GetModelContext);

            return(new LabResultPatternsTestUser(appModel, testDevice, pageCheckManager));
        }
예제 #3
0
 public LabResultPatternsTestUser
 (
     LabPatternResultsAppModel appModel,
     LabPatternResultsTestDevice testDevice,
     PageCheckManager pageCheckManager
 )
 {
     _appModel         = appModel;
     _testDevice       = testDevice;
     _pageCheckManager = pageCheckManager;
 }
예제 #4
0
        private async Task CheckModalPage
        (
            LabPatternResultsAppModel appModel,
            LabPatternResultsTestDevice testDevice
        )
        {
            if (appModel.ModalState != ModalState.Login)
            {
                return;
            }
            var loginPage = testDevice.Navigation.ModalStack.Last() as LoginPage;

            Assert.NotNull(loginPage);
            _loginPageChecker.Check(appModel.ExpectedLoginPage, loginPage);
        }
예제 #5
0
 public async Task Check
 (
     LabPatternResultsAppModel appModel,
     LabPatternResultsTestDevice testDevice
 )
 {
     Assert.AreEqual(appModel.ModalCount, testDevice.Navigation.ModalStack.Count);
     Assert.AreEqual(appModel.NavCount, testDevice.Navigation.NavigationStack.Count);
     if (appModel.ModalCount > 0)
     {
         await CheckModalPage(appModel, testDevice);
     }
     else
     {
         await CheckNavPage(appModel, testDevice);
     }
 }