public void AddAFeatureAndCheckThatTheExportMethodHasExportedAJSONFile() { using (PlannerContext pc = new PlannerContext()) { Feature _testFeat = new Feature() { Title = "TestFeat", Description = "This is a test feature", Status = 2, Priority = 1, Notes = "No notes needed", ProjectId = _crudProjectManager.SelectedProject.ProjectId }; pc.Features.Add(_testFeat); pc.SaveChanges(); _jsonExporter.InitSerialisation(); _jsonExporter.SerialiseFeatures(); FileAssert.Exists(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Features.json"); } }
private void JSONButton_Click(object sender, RoutedEventArgs e) { ExportOutPutStackPanel.Children.Clear(); _jsonExporter.InitSerialisation(); TextBlock _projectOutput; TextBlock _featuretOutput; TextBlock _issueOutput; TextBlock _noteOutput; if (ExportProjectsCheckBox.IsChecked == true) { string _outputMessage = _jsonExporter.SerialiseProjects(); _projectOutput = new TextBlock() { Text = _outputMessage, Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D2D1D3")), FontSize = 25, Margin = new Thickness(45, 20, 45, 0), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap }; ExportOutPutStackPanel.Children.Add(_projectOutput); } if (ExportFeaturesCheckBox.IsChecked == true) { string _outputMessage = _jsonExporter.SerialiseFeatures(); _featuretOutput = new TextBlock() { Text = _outputMessage, Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D2D1D3")), FontSize = 25, Margin = new Thickness(45, 20, 45, 0), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap }; ExportOutPutStackPanel.Children.Add(_featuretOutput); } if (ExportIssuesCheckBox.IsChecked == true) { string _outputMessage = _jsonExporter.SerialiseIssues(); _issueOutput = new TextBlock() { Text = _outputMessage, Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D2D1D3")), FontSize = 25, Margin = new Thickness(45, 20, 45, 0), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap }; ExportOutPutStackPanel.Children.Add(_issueOutput); } if (ExportNotesCheckBox.IsChecked == true) { string _outputMessage = _jsonExporter.SerialiseNotes(); _noteOutput = new TextBlock() { Text = _outputMessage, Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D2D1D3")), FontSize = 25, Margin = new Thickness(45, 20, 45, 0), TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap }; ExportOutPutStackPanel.Children.Add(_noteOutput); } }