Beispiel #1
0
        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);
            }
        }
        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);
                }
        }