public void Should_NotFindWay_When_ThereNone()
        {
            var finder = new NetworkPathFinder(NoWayArgs);

            finder.GetWay().Should().BeNull();
            finder.Cost.Should().Be(1);
        }
 public void Crash()
 {
     pathFinder = new NetworkPathFinder(CrachingArgs);
     pathFinder.GetWay().Should().BeEquivalentTo(new List <int> {
         1, 3, 6, 7, 8
     });
     pathFinder.Cost.Should().Be(7500);
 }
        public void Input5()
        {
            var args = File.ReadAllLines(@"C:\Users\Olga\source\repos\combinatoric_algorithms\3_task\bin\Debug\In5.txt");

            pathFinder = new NetworkPathFinder(args);
            var way = pathFinder.GetWay();

            way.Should().BeNull();
            pathFinder.Cost.Should().Be(1);
        }
        public void Should_FindShortesWay()
        {
            var finder   = new NetworkPathFinder(AnotherWayArgs);
            var wayStack = finder.GetWay();
            var way      = new List <int>();

            while (wayStack.Count != 0)
            {
                way.Add(wayStack.Pop());
            }
            way.Should().BeEquivalentTo(new List <int> {
                1, 2
            });
            finder.Cost.Should().Be(25);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            args = File.ReadAllLines("in.txt");
            var finder   = new NetworkPathFinder(args);
            var wayStack = finder.GetWay();

            if (wayStack == null)
            {
                File.WriteAllText("out.txt", "N");
                return;
            }
            var way = new StringBuilder();

            while (wayStack.Count != 0)
            {
                way.Append($"{wayStack.Pop()} ");
            }
            File.WriteAllLines("out.txt", new [] { "Y", way.ToString().Trim(), finder.Cost.ToString() });
        }
 public void SetUp()
 {
     pathFinder = new NetworkPathFinder(ExampleArgs);
 }