Пример #1
0
        private void SaveNetworkLocation_OnClick(object sender, RoutedEventArgs e)
        {
            var filename = GetPathFromDialog();

            if (filename != null)
            {
                var locations = GetNodesLocations();

                _networkLocationMapRetriever.Write(filename, locations);

                MessageBox.Show("File saved!", "OK", MessageBoxButton.OK, MessageBoxImage.Information,
                                MessageBoxResult.OK,
                                MessageBoxOptions.None);
            }
        }
Пример #2
0
        public void WriteShouldCorrectlyWriteInfoInFile()
        {
            // Arrange
            // Act
            _networkLocationMapRetriever.Write(WriteFilename, _nodeLocationsMap);

            // 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);
                }
        }