public void ReturnsTheRightStringWhenWorkingWithTemptyColumnsInHeader()
        {
            //Arrange
            var data = new List <List <string> >();

            data.Add(new List <string>()
            {
                "", "", "The Name"
            });
            data.Add(new List <string>()
            {
                "1", "First of his Name", "Heinz Dovenschmirtz"
            });
            data.Add(new List <string>()
            {
                "2", "Mother of dragons", "Mickey Mouse"
            });

            //Act
            var result = TableToTextPrinter.TableToText(data);

            //Assert
            var expected = $@"|                       |      The Name       |{Environment.NewLine}| 1 | First of his Name | Heinz Dovenschmirtz |{Environment.NewLine}| 2 | Mother of dragons |    Mickey Mouse     |{Environment.NewLine}";

            Assert.Equal(expected, result);
        }
        public void ReturnsTheRightString()
        {
            //Arrange
            var data = new List <List <string> >();

            data.Add(new List <string>()
            {
                "", "First Name", "Last Name"
            });
            data.Add(null);
            data.Add(new List <string>()
            {
                "1", "Heinz", "Dovenschmirtz"
            });
            data.Add(new List <string>()
            {
                "2", "Mickey", "Mouse"
            });

            //Act
            var result = TableToTextPrinter.TableToText(data);

            //Assert
            var expected = $@"|   | First Name |   Last Name   |{Environment.NewLine}----------------------------------{Environment.NewLine}| 1 |   Heinz    | Dovenschmirtz |{Environment.NewLine}| 2 |   Mickey   |     Mouse     |{Environment.NewLine}";

            Assert.Equal(expected, result);
        }
        public void ShowRecupFilesDetails(List <RecupFile> recupFiles)
        {
            var tableContent = new List <List <string> >();

            tableContent.Add(new List <string>()
            {
                "Extension", "Count", "Total size"
            });
            tableContent.Add(null);

            var groups = recupFiles.GroupBy(t => t.Extension).OrderByDescending(t => t.Sum(z => z.Size));

            foreach (var group in groups)
            {
                tableContent.Add(new List <string>()
                {
                    group.Key,
                    group.Count().ToString(),
                    ValuesToStringHelper.BytesToString(group.Sum(t => t.Size))
                });
            }

            tableContent.Add(null);
            tableContent.Add(new List <string>()
            {
                "Total:", recupFiles.Count.ToString(), ValuesToStringHelper.BytesToString(recupFiles.Sum(t => t.Size))
            });

            var str = TableToTextPrinter.TableToText(tableContent);

            Console.WriteLine(str);
        }
        public void WorksWithNullValues()
        {
            //Arrange
            var data = new List <List <string> >();

            data.Add(new List <string>()
            {
                "", "First Name", "Last Name"
            });
            data.Add(new List <string>()
            {
                "1", null, "Dovenschmirtz"
            });
            data.Add(null);

            //Act
            var result = TableToTextPrinter.TableToText(data);

            //Assert
            var expected = $@"|   | First Name |   Last Name   |{Environment.NewLine}| 1 |            | Dovenschmirtz |{Environment.NewLine}----------------------------------{Environment.NewLine}";

            Assert.Equal(expected, result);
        }