Exemplo n.º 1
0
        public void GetHeaderTest_Should_Return_Header_With_8_Fields()
        {
            // Arrange
            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            string    spreadsheetString = "[{\"Column0\":\"OrderDate\",\"Column1\":\"Region's\",\"Column2\":\"Rep\",\"Column3\":\"Item\",\"Column4\":\"Units\",\"Column5\":\"Unit Cost\",\"Column6\":\"Total\"},{\"Column0\":\"2016-01-06T00:00:00\",\"Column1\":\"East's\",\"Column2\":\"Jones\",\"Column3\":\"Pencil\",\"Column4\":95.0,\"Column5\":1.99,\"Column6\":189.05}]".Replace("\\", "");
            DataTable dataTable         = JsonConvert.DeserializeObject <DataTable>(spreadsheetString);

            // Act
            Header header = generateFiles.GetHeader(dataTable);

            // Assert
            header.Should().NotBeNull();
            header.Fields.Count.Should().Be(8);
        }