public void OpenComplex_ProjectHasTestResults()
        {
            OpenProjectCommand openCommand = new OpenProjectCommand();

            openCommand.Execute(Path.Combine(ResourcesDirectory, "TestResults" + Project.FileExtension));

            Project loaded = ProjectManager.CurrentProject;

            Assert.AreEqual("Test Results", loaded.Name);
            Assert.AreEqual(Platform.x86, loaded.Platform);
            Assert.AreEqual(TimeSpan.Zero, loaded.Frequency);

            string expectedFileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "DummyTestProjectsForTesting", "DummyCSharpTestProject", "bin", "Debug", "DummyCSharpTestProject.dll");

            Assert.IsTrue(Path.GetFileName(expectedFileName) == Path.GetFileName(loaded.FullPathToDll));
            Assert.AreEqual(3, loaded.TestResults.Count);

            List <TestResult> expected = new List <TestResult>()
            {
                new TestResult(@"C:\Users\alawi\Source\Repos\TestRunner\TestRunnerUnitTests\Resources\TestResult1.ftr"),
                new TestResult(@"C:\Users\alawi\Source\Repos\TestRunner\TestRunnerUnitTests\Resources\TestResult2.ftr"),
                new TestResult(@"C:\Users\alawi\Source\Repos\TestRunner\TestRunnerUnitTests\Resources\TestResult3.ftr"),
            };

            AssertExt.ContentsEqual <List <TestResult>, TestResult>(expected, loaded.TestResults, TestRunnerEqualityFunctions.TestResultEquality);
        }
        public static void Load()
        {
            var settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RivalsAdventureEditor", "AppSettings.cfg");

            if (File.Exists(settingsPath))
            {
                using (StreamReader reader = new StreamReader(settingsPath))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    Instance = (ApplicationSettings)serializer.Deserialize(reader, typeof(ApplicationSettings));
                    foreach (string path in Instance.ProjectPaths)
                    {
                        var cmd = new OpenProjectCommand();
                        cmd.Execute(path);
                    }
                    Instance.ActiveProject = Instance.Projects.FirstOrDefault(p => p.ProjectPath == Instance.ActiveProjectPath);
                    if (Instance.ActiveRoomNum != -1 && (Instance.ActiveProject?.Rooms.Count ?? 0) > 0)
                    {
                        Instance.ActiveRoom = Instance.ActiveProject?.Rooms[Instance.ActiveRoomNum];
                    }
                }
            }
            else
            {
                Instance = new ApplicationSettings();
            }
        }
        public void Open_CallsOnLoadedEvent()
        {
            bool value = false;

            OpenProjectCommand.ProjectLoaded += delegate(Project project)
            {
                value = true;
            };

            OpenProjectCommand openCommand = new OpenProjectCommand();

            openCommand.Execute(Path.Combine(ResourcesDirectory, "NoTestResults" + Project.FileExtension));

            Assert.IsTrue(value);
        }
示例#4
0
        public void AddNewProjectToList(IProject project)
        {
            var menu = new ContextMenu();

            menu.Items.Add(new MenuItem
            {
                Header           = Language["Open"],
                Command          = OpenProjectCommand,
                CommandParameter = project
            });
            menu.Items.Add(new MenuItem
            {
                Header           = Language["Delete"],
                Command          = DeleteProjectCommand,
                CommandParameter = project
            });

            var node = new TreeViewItem
            {
                Header      = project.Name,
                Style       = App.Current.TryFindResource("StyledTreeViewItem") as Style,
                Tag         = project,
                ContextMenu = menu
            };

            node.MouseDoubleClick += (s, e) =>
            {
                if (!(s as TreeViewItem).IsSelected)
                {
                    return;
                }

                OpenProjectCommand.Execute(project);
                e.Handled = true;
            };

            var parent = FindNode(Projects, project.Parent);

            if (parent != null)
            {
                parent.Items.Add(node);
            }
            else
            {
                Projects.Add(node);
            }
        }
        public void OpenSimple_ProjectHasNoTestResults()
        {
            OpenProjectCommand openCommand = new OpenProjectCommand();

            openCommand.Execute(Path.Combine(ResourcesDirectory, "NoTestResults" + Project.FileExtension));

            Project loaded = ProjectManager.CurrentProject;

            Assert.AreEqual("No Test Results", loaded.Name);
            Assert.AreEqual(Platform.x86, loaded.Platform);
            Assert.AreEqual(TimeSpan.Zero, loaded.Frequency);

            string expectedFileName = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "DummyTestProjectsForTesting", "DummyCSharpTestProject", "bin", "Debug", "DummyCSharpTestProject.dll");

            Assert.IsTrue(Path.GetFileName(expectedFileName) == Path.GetFileName(loaded.FullPathToDll));
            Assert.AreEqual(0, loaded.TestResults.Count);
        }
        private void OpenProject(object sender, ExecutedRoutedEventArgs e)
        {
            var cmd = new OpenProjectCommand();

            cmd.Execute(e.Parameter);
        }
示例#7
0
        public void Execute_should_reset_test_status()
        {
            openProjectCommand.Execute(MockProgressMonitor.Instance);

            eventAggregator.AssertWasCalled(ea => ea.Send(Arg.Is(openProjectCommand), Arg <TestsReset> .Is.Anything));
        }
 /// <summary>
 /// Occurs when the browse projects button is pressed.
 /// </summary>
 public void BrowseButtonPressed()
 {
     _openProjectCommand.Execute();
 }