private void XMLButton_Click(object sender, RoutedEventArgs e) { ExportOutPutStackPanel.Children.Clear(); _xmlExporter.InitSerialisation(); TextBlock _projectOutput; TextBlock _featuretOutput; TextBlock _issueOutput; TextBlock _noteOutput; if (ExportProjectsCheckBox.IsChecked == true) { string _outputMessage = _xmlExporter.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 = _xmlExporter.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 = _xmlExporter.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 = _xmlExporter.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); } }
public void AddAProjectAndCheckThatTheExportMethodHasExportedAXMLFile() { using (PlannerContext pc = new PlannerContext()) { Project _testProj = new Project() { Title = "TestProj", Description = "A blank test project", Status = 1, Link = "No Link" }; pc.Projects.Add(_testProj); pc.SaveChanges(); _xmlExporter.InitSerialisation(); _xmlExporter.SerialiseProjects(); FileAssert.Exists(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\XML Export\Projects.xml"); } }