public void RailwayPartGenerator_Generate_ExpectEqual()
        {
            Railway.RailwayParts.Clear();
            var dataRead  = TrackReader.Read(new string[] { "[1]" });
            var railParts = RailwayPartsORM.Map(dataRead);
            var expected  = new List <IRailwayPart>
            {
                new Rail()
                {
                    Char        = '[',
                    CoordinateX = 0,
                    CoordinateY = 0,
                },
                new Station()
                {
                    Char        = '1',
                    CoordinateX = 1,
                    CoordinateY = 0,
                },
                new Rail()
                {
                    Char        = ']',
                    CoordinateX = 2,
                    CoordinateY = 0,
                },
            };
            var railString = JsonConvert.SerializeObject(railParts);
            var expString  = JsonConvert.SerializeObject(expected);

            Assert.Equal(expString, railString);
        }
        public void Station_Generate_ExpectStation()
        {
            Railway.RailwayParts.Clear();
            var dataRead  = TrackReader.Read(new string[] { "-1-" });
            var railParts = RailwayPartsORM.Map(dataRead);

            Assert.IsType <Station>(railParts[1]);
        }
        public void RailwayPartGenerator_Generate_ExpectThree2()
        {
            Railway.RailwayParts.Clear();
            var dataRead  = TrackReader.Read(new string[] { "-1-" });
            var railParts = RailwayPartsORM.Map(dataRead);

            Assert.True(railParts.Count == 3);
        }
Exemple #4
0
        public void ConnectStations_raw_2_Check_last()
        {
            Railway.RailwayParts.Clear();
            var read  = TrackReader.Read(File.ReadAllLines(@"TrainTestTrack.txt"));
            var parts = RailwayPartsORM.Map(read);

            Railway.AppendParts(parts);

            var station = parts[^ 1];
Exemple #5
0
        public void ConnectStations_raw_2_test_to_Railway()
        {
            Railway.RailwayParts.Clear();
            var read  = TrackReader.Read(File.ReadAllLines(@"TrainTestTrack.txt"));
            var parts = RailwayPartsORM.Map(read);

            Railway.AppendParts(parts);

            Assert.True(parts.Count == 5);
        }
Exemple #6
0
        public void ConnectStations_raw_2_CheckStation()
        {
            Railway.RailwayParts.Clear();
            var read  = TrackReader.Read(File.ReadAllLines(@"TrainTestTrack.txt"));
            var parts = RailwayPartsORM.Map(read);

            Railway.AppendParts(parts);

            var station = parts[0];

            Assert.IsType <Station>(station);
        }