private void ReadNetworkLocation_OnClick(object sender, RoutedEventArgs e) { var filename = GetPathFromDialog(); try { var locations = _networkLocationMapRetriever.Read(filename); _nodeDrawer = new SmartNodeDrawer(_network, locations); _networkDrawer = new NetworkDrawer(_nodeDrawer, _channelDrawer); NetworkArea.Children.Remove(GeneratedCanvas); _networkDrawer.DrawComponents(NetworkArea); MessageBox.Show("File loaded!", "OK", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.None); } }
public void ReadShouldReturnCorrectArray() { // Arrange // Act var result = _networkLocationMapRetriever.Read(ReadFilename); // Assert Assert.That(result.Length, Is.EqualTo(_nodeLocationsMap.Length)); foreach (var resultNodeLocationDto in result) { var nodeLocationDto = _nodeLocationsMap.First(n => n.Id == resultNodeLocationDto.Id); Assert.That(Math.Abs(resultNodeLocationDto.X - nodeLocationDto.X), Is.LessThanOrEqualTo(AllConstants.Eps)); Assert.That(Math.Abs(resultNodeLocationDto.Y - nodeLocationDto.Y), Is.LessThanOrEqualTo(AllConstants.Eps)); } }