public async Task CanSaveAsLogFromZipContainer(TestAppInstance app) { CloseDialog(); app.PresentationObjects.AlertPopup.ShowPopup(null, null, UI.Presenters.AlertFlags.None).ReturnsForAnyArgs(UI.Presenters.AlertFlags.Yes); app.ViewModel.SourcesManager.OnDeleteAllLogSourcesButtonClicked(); await app.EmulateFileDragAndDrop(await samples.GetSampleAsLocalFile("XmlWriterTraceListener1AndImage.zip")); await app.WaitFor(() => app.ViewModel.SourcesList.RootItem.Children.Count == 1); app.ViewModel.SourcesList.OnSelectionChange(new[] { (SrcListItem)app.ViewModel.SourcesList.RootItem.Children[0] }); await OpenDialog(); Check.That(DialogState.SaveAsButton.Disabled).IsFalse(); Check.That(DialogState.SaveAsButton.Hidden).IsFalse(); var destinationFileName = app.ModelObjects.TempFilesManager.GenerateNewName(); app.Mocks.FileDialogs.SaveFileDialog(Arg.Any <UI.Presenters.SaveFileDialogParams>()).ReturnsForAnyArgs(destinationFileName); ViewModel.OnSaveAsButtonClicked(); app.Mocks.FileDialogs.Received(1).SaveFileDialog(Arg.Any <UI.Presenters.SaveFileDialogParams>()); var savedLog = File.ReadAllText(destinationFileName); var head = "<E2ETraceEvent xmlns=\"http://schemas.microsoft.com/2004/06/E2ETraceEvent\"><System xmlns=\"http://schemas.microsoft.com/2004/06/windows/eventlog/system\"><EventID>0</EventID><Type>3</Type><SubType Name=\"Start\">0</SubType><Level>255</Level><TimeCreated SystemTime=\"2011-07-24T10:37:25.9854589Z\" /><Source Name=\"SampleApp\" />"; Check.That(head).IsEqualTo(savedLog.Substring(0, head.Length)); }
public async Task BeforeEach(TestAppInstance app) { appInstance = app; samples = app.Samples; tempLogFileName = Path.Combine(app.AppDataDirectory, "XmlWriterTraceListener1.xml"); File.Copy(await samples.GetSampleAsLocalFile("XmlWriterTraceListener1.xml"), tempLogFileName, overwrite: true); await app.EmulateFileDragAndDrop(tempLogFileName); await app.WaitFor(() => app.ViewModel.LoadedMessagesLogViewer.ViewLines.Length > 0); await app.WaitFor(() => app.ViewModel.SourcesList.RootItem.Children.Count == 1); app.ViewModel.SourcesList.OnSelectionChange(new[] { (SrcListItem)app.ViewModel.SourcesList.RootItem.Children[0] }); await OpenDialog(); }