Exemple #1
0
        public void AddExtraNumberFields_Should_Add_Label_And_Message_Fields_With_Lenghts_When_Where_Are_In_OutExtraNumberFields()
        {
            // Arrange
            string label         = "label";
            int    length        = 100;
            string message       = "message";
            int    lengthMessage = 200;
            string dummy         = "dummy";
            string lengthDummy   = "xxx";
            string fieldName     = $"{label}={length},{message}={lengthMessage},{dummy}={lengthDummy}";

            this.configMock.Setup(m => m.OutExtraNumberFields).Returns(fieldName);

            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            Header header = new Header();

            // Act
            generateFiles.AddExtraNumberFields(header);

            // Assert
            header.Fields.Find(f => f.Name == label).Length.Should().Be(length);
            header.Fields.Find(f => f.Name == message).Length.Should().Be(lengthMessage);
            header.Fields.Find(f => f.Name == dummy).Length.Should().Be(10);
        }
Exemple #2
0
        public void AddExtraNumberFields_Let_Header_Null_When_Is_Null()
        {
            // Arrange
            this.configMock.Setup(m => m.OutExtraNumberFields).Returns("label");

            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            Header header = null;

            // Act
            generateFiles.AddExtraNumberFields(header);

            // Assert
            header.Should().BeNull();
        }
Exemple #3
0
        public void AddExtraNumberFields_Should_Add_Label_Field_And_Length_When_It_Is_a_OutExtraNumberFields()
        {
            // Arrange
            string label     = "label";
            int    length    = 100;
            string fieldName = $"{label}={length}";

            this.configMock.Setup(m => m.OutExtraNumberFields).Returns(fieldName);

            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            Header header = new Header();

            // Act
            generateFiles.AddExtraNumberFields(header);

            // Assert
            header.Fields.Find(f => f.Name == label).Length.Should().Be(length);
        }
Exemple #4
0
        public void AddExtraNumberFields_Should_Add_Label_Field_When_It_Is_a_OutExtraNumberFields()
        {
            // Arrange
            string fieldName = "label";

            this.configMock.Setup(m => m.OutExtraNumberFields).Returns(fieldName);

            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            Header header = new Header();

            // Act
            generateFiles.AddExtraNumberFields(header);

            // Assert
            header.Fields.Find(f => f.Name == fieldName).Name.Should().Be(fieldName);
            header.Fields.Find(f => f.Name == fieldName).Type.Should().Be(DatabaseEnum.TypeField.Number);
            header.Fields.Find(f => f.Name == fieldName).Extra.Should().BeTrue();
        }
Exemple #5
0
        public void AddExtraNumberFields_Should_Add_Label_And_Message_Field_When_There_Are_OutExtraNumberFields()
        {
            // Arrange
            string label     = "label";
            string message   = "message";
            string fieldName = $"{label},{message}";

            this.configMock.Setup(m => m.OutExtraNumberFields).Returns(fieldName);

            GenerateFiles generateFiles = new GenerateFiles(this.config, this.spreadsheet, this.fileSystem, this.outputWriter);

            Header header = new Header();

            // Act
            generateFiles.AddExtraNumberFields(header);

            // Assert
            header.Fields.Find(f => f.Name == label).Name.Should().Be(label);
            header.Fields.Find(f => f.Name == message).Name.Should().Be(message);
        }