Пример #1
0
        public static void LaunchLogoAppOnPrimaryDevice(PlatformName platform)
        {
            new ConsoleLogger();
            AppInfo app = AppBuilderTestExtensions.TryGetAlreadyBuiltApp("LogoApp", platform);

            app.LaunchAppOnPrimaryDevice();
        }
        public void RebuildEventShouldGetRaisedWhenRebuildWasRequested()
        {
            AppInfo anyApp = AppBuilderTestExtensions.GetMockAppInfo("TestApp", PlatformName.Windows);

            appListViewModel.RebuildRequest += (appInfo) => AssertBuiltApp(anyApp, appInfo);
            appListViewModel.RequestRebuild(anyApp);
        }
        private void AddMockAppInfoAndSaveWithDummyData(string appName)
        {
            string folder = appListViewModel.AppStorageDirectory;

            appListViewModel.AddApp(
                AppBuilderTestExtensions.GetMockAppInfo(appName, PlatformName.Windows, folder),
                new byte[] { 1 });
        }
        private static BuiltAppsListViewModel GetBuiltAppsListWithDummyEntry()
        {
            var listViewModel = new BuiltAppsListViewModel(new MockSettings());

            listViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo("Windows app",
                                                                         PlatformName.Windows));
            return(listViewModel);
        }
Пример #5
0
        public static void LaunchLogoAppOnEmulatorDevice(PlatformName platform)
        {
            new ConsoleLogger();
            AppInfo app      = AppBuilderTestExtensions.TryGetAlreadyBuiltApp("LogoApp", platform);
            Device  emulator = app.AvailableDevices.FirstOrDefault(device => device.IsEmulator);

            app.LaunchAppOnDevice(emulator);
        }
        private static AppBuildMessagesListViewModel GetViewModelWithOneMessageForEachIssueType()
        {
            var messagesList = new AppBuildMessagesListViewModel();

            messagesList.AddMessage(AppBuilderTestExtensions.AsBuildTestWarning("Test warning"));
            messagesList.AddMessage(AppBuilderTestExtensions.AsBuildTestError("Test error"));
            return(messagesList);
        }
        public void RequestRequild()
        {
            int     numberOfRequests = service.NumberOfBuildRequests;
            AppInfo app = AppBuilderTestExtensions.TryGetAlreadyBuiltApp("LogoApp", PlatformName.Windows);

            app.SolutionFilePath = SolutionExtensions.GetSamplesSolutionFilePath();
            viewModel.AppListViewModel.RequestRebuild(app);
            Assert.AreEqual(numberOfRequests + 1, service.NumberOfBuildRequests);
        }
Пример #8
0
        public void ShowViewWithWithDummyMessages()
        {
            var listViewModel = CreateViewModelWithDummyMessages();
            var window        = CreateVerifiableWindowFromViewModel(listViewModel);

            listViewModel.AddMessage(
                AppBuilderTestExtensions.AsBuildTestError("This error was added later"));
            window.ShowDialog();
        }
        public void ShowViewWithLogoAppForWindows()
        {
            var     listViewModel = new BuiltAppsListViewModel(new MockSettings());
            AppInfo app           = AppBuilderTestExtensions.TryGetAlreadyBuiltApp("LogoApp", PlatformName.Windows);

            listViewModel.AddApp(app);
            var window = CreateVerifiableWindowFromViewModel(listViewModel);

            window.ShowDialog();
        }
        public void CheckDataForWarningMessage()
        {
            const string    WarningText             = "A bug but not crash";
            AppBuildMessage warningMessage          = AppBuilderTestExtensions.AsBuildTestWarning(WarningText);
            var             warningMessageViewModel = new AppBuildMessageViewModel(warningMessage);

            Assert.IsTrue(warningMessageViewModel.ImagePath.Contains("Warning"));
            AssertMessageTextAndProjectWithFileData(WarningText, warningMessageViewModel);
            AssertMessageIsoData(warningMessageViewModel);
        }
        public void CheckDataForErrorMessage()
        {
            const string    ErrorText             = "A bad crash";
            AppBuildMessage errorMessage          = AppBuilderTestExtensions.AsBuildTestError(ErrorText);
            var             errorMessageViewModel = new AppBuildMessageViewModel(errorMessage);

            Assert.IsTrue(errorMessageViewModel.ImagePath.Contains("Error"));
            AssertMessageTextAndProjectWithFileData(ErrorText, errorMessageViewModel);
            AssertMessageIsoData(errorMessageViewModel);
        }
        public void AddValidBuiltApp()
        {
            int builtApps = 0;

            appListViewModel.NumberOfBuiltAppsChanged +=
                () => builtApps = appListViewModel.NumberOfBuiltApps;
            appListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo("AppNotSavedOnDisk",
                                                                            PlatformName.Windows));
            Assert.AreEqual(builtApps, appListViewModel.NumberOfBuiltApps);
        }
Пример #13
0
        private static BuiltAppsListViewModel CreateAppsListViewModelWithDummyEntries()
        {
            var appListViewModel = new BuiltAppsListViewModel(new MockSettings());

            appListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo("A Windows app",
                                                                            PlatformName.Windows));
            appListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo("A Windows Phone 7 app",
                                                                            PlatformName.WindowsPhone7));
            return(appListViewModel);
        }
        public void CheckDataForInfoMessage()
        {
            const string    InfoText             = "Just a note";
            AppBuildMessage infoMessage          = AppBuilderTestExtensions.AsBuildTestInfo(InfoText);
            var             infoMessageViewModel = new AppBuildMessageViewModel(infoMessage);

            Assert.IsTrue(infoMessageViewModel.ImagePath.Contains("Info"));
            AssertMessageTextAndProject(InfoText, infoMessageViewModel);
            Assert.IsEmpty(infoMessageViewModel.FileWithLineAndColumn);
            AssertMessageIsoData(infoMessageViewModel);
        }
        public void ShowViewWithSeveralAppEntries()
        {
            BuiltAppsListViewModel list = GetBuiltAppsListWithDummyEntry();

            list.AddApp(AppBuilderTestExtensions.GetMockAppInfo("Windows app", PlatformName.Windows));
            list.AddApp(AppBuilderTestExtensions.GetMockAppInfo("Android app", PlatformName.Android));
            list.AddApp(AppBuilderTestExtensions.GetMockAppInfo("Web app", PlatformName.Web));
            var window = CreateVerifiableWindowFromViewModel(list);

            window.ShowDialog();
        }
Пример #16
0
        private static AppBuildMessagesListViewModel CreateViewModelWithDummyMessages()
        {
            var listViewModel = new AppBuildMessagesListViewModel();

            listViewModel.AddMessage(
                AppBuilderTestExtensions.AsBuildTestWarning("A simple build warning"));
            listViewModel.AddMessage(
                AppBuilderTestExtensions.AsBuildTestError("A simple build error"));
            listViewModel.AddMessage(
                AppBuilderTestExtensions.AsBuildTestError("A second simple build error"));
            return(listViewModel);
        }
        public void ShowViewWithMockServiceAndDummyApps()
        {
            AppBuilderView      builderView = CreateViewAndViewModelViaMockService();
            AppBuilderViewModel viewModel   = builderView.ViewModel;

            viewModel.AppListViewModel.AddApp(
                AppBuilderTestExtensions.GetMockAppInfo("My favorite app", PlatformName.Windows));
            viewModel.AppListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo(
                                                  "My mobile app", PlatformName.Android));
            viewModel.AppListViewModel.AddApp(AppBuilderTestExtensions.GetMockAppInfo(
                                                  "My cool web app", PlatformName.Web));
            WpfWindow window = CreateTestWindow(builderView);

            window.ShowDialog();
        }
        public void AddDifferentMessages()
        {
            var messagesList = new AppBuildMessagesListViewModel();

            messagesList.AddMessage(
                AppBuilderTestExtensions.AsBuildTestWarning("A test warning for this test"));
            messagesList.AddMessage(
                AppBuilderTestExtensions.AsBuildTestError("A test error for this test"));
            messagesList.AddMessage(
                AppBuilderTestExtensions.AsBuildTestError("Just another test error for this test"));
            Assert.AreEqual(1, messagesList.Warnings.Count);
            Assert.AreEqual("1 Warning", messagesList.TextOfWarningCount);
            Assert.AreEqual(2, messagesList.Errors.Count);
            Assert.AreEqual("2 Errors", messagesList.TextOfErrorCount);
        }
        public void ShowIconOfOfficialSupportedPlatforms()
        {
            BuiltAppsListViewModel     list         = GetBuiltAppsListWithDummyEntry();
            IEnumerable <PlatformName> allPlatforms = EnumExtensions.GetEnumValues <PlatformName>();

            foreach (PlatformName platform in allPlatforms)
            {
                if (platform != PlatformName.WindowsPhone7)
                {
                    list.AddApp(AppBuilderTestExtensions.GetMockAppInfo(platform + " app", platform));
                }
            }
            var window = CreateVerifiableWindowFromViewModel(list);

            window.ShowDialog();
        }
Пример #20
0
 private static AppInfo GetMockAppInfo(string appName,
                                       PlatformName platform = PlatformName.Windows)
 {
     return(AppBuilderTestExtensions.GetMockAppInfo(appName, platform));
 }
Пример #21
0
 public void RaiseAppBuildWarning(string message)
 {
     ReceiveData(AppBuilderTestExtensions.AsBuildTestWarning(message));
 }
Пример #22
0
 public void RaiseAppBuildInfo(string message)
 {
     ReceiveData(AppBuilderTestExtensions.AsBuildTestInfo(message));
 }
Пример #23
0
 public void ReceiveSomeTestMessages()
 {
     RaiseAppBuildWarning("A BuildWarning");
     ReceiveData(AppBuilderTestExtensions.AsBuildTestError("A BuildError"));
 }