Ejemplo n.º 1
0
        public async void A_non_empty_file_line_outputs_a_correct_gsak_line(GsakFileLine gsakFileLine, string expected)
        {
            var sut    = new GsakFileLineToStringConverter();
            var actual = await sut.Convert(gsakFileLine);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public async void An_empty_GSAK_file_line_outputs_an_empty_string()
        {
            var expected = String.Empty;
            var sut      = new GsakFileLineToStringConverter();
            var actual   = await sut.Convert(GsakTestHelper.EmptyGsakFileLine);

            Assert.Equal(expected, actual);
        }
        public async void A_valid_GSAK_file_outputs_a_header_and_each_line_on_a_seperate_line()
        {
            var gsakFileLineToStringConverter = new GsakFileLineToStringConverter();
            var expectedHeader = "\"Code\",\"Waypoint Name\",\"Latitude\",\"Longitude\"";
            var expectedBody   = String.Join(
                Environment.NewLine,
                String.Join(
                    Environment.NewLine,
                    GsakTestHelper.ValidGsakFile
                    .Lines
                    .Select(async gfl => await gsakFileLineToStringConverter.Convert(gfl))
                    .Select(gflString => gflString.Result)
                    )
                );
            var expected = $"{expectedHeader}{Environment.NewLine}{expectedBody}";
            var sut      = new GsakFileToStringConverter(new GsakFileLineToStringConverter());
            var actual   = await sut.Convert(GsakTestHelper.ValidGsakFile);

            Assert.Equal(expected, actual);
        }