コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: L0ndra/Coursework
        private void SaveNetwork_OnClick(object sender, RoutedEventArgs e)
        {
            var filename = GetPathFromDialog();

            if (filename != null)
            {
                _networkInfoRetriever.Write(filename, _network);

                MessageBox.Show("File saved!", "OK", MessageBoxButton.OK, MessageBoxImage.Information,
                                MessageBoxResult.OK,
                                MessageBoxOptions.None);
            }
        }
コード例 #2
0
        public void WriteShouldWriteNetworkToFileWithoutErrors()
        {
            // Arrange
            // Act
            _networkInfoRetriever.Write(WriteFilename, _network);

            // Assert
            using (var testFile = new StreamReader(ReadFilename))
                using (var writedFile = new StreamReader(WriteFilename))
                {
                    while (!testFile.EndOfStream)
                    {
                        var testString   = testFile.ReadLine();
                        var writedString = writedFile.ReadLine();

                        Assert.That(testString, Is.EqualTo(writedString));
                    }

                    Assert.IsTrue(writedFile.EndOfStream);
                }
        }