public void WithNull_ShouldReturnNull()
        {
            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(null);

            dto.Should().BeNull();
        }
        public void WithTagHavingStringValue_ShouldReturnDtoWithStringType()
        {
            Tag             tag       = VelocityTag("STRING(80)");
            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.Type.Should().Be("System.String");
        }
        public void GivenNestedTypeName_WithTagHavingEnumValue_ShouldReturnDtoWithShortType()
        {
            Tag             tag       = VelocityTag(dataType: "BasePPT.E_DJM_PRINT_MODULE");
            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.Type.Should().Be("System.Int16");
        }
        public void WithTagVelocityHavingValueNull_ShouldReturnDtoWithEmptyValue()
        {
            Tag tag = VelocityTag(value: null);

            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.Value.Should().Be(string.Empty);
        }
        public void WithTagVelocityHavingTypeStatisticalData_ShouldReturnDtoWithTypeNull()
        {
            Tag velocityTag = VelocityTag(value: 12, dataType: "T_StatisticalData");

            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(velocityTag);

            dto.Type.Should().BeNull();
        }
        public void WithTagHavingListValue_ShouldReturnDtoWithListValue()
        {
            Tag tag = VelocityTag(value: null,
                                  dataType: "ARRAY (..) of INT",
                                  children: new[] { VelocityTag(value: 1, dataType: "INT"), VelocityTag(value: 2, dataType: "INT") });

            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.Type.Should().Be("System.Array");
            dto.Children.Should().Contain(child => child.Type == "System.Int16" && child.Value == "1")
            .And.Contain(child => child.Type == "System.Int16" && child.Value == "2");
        }
        public void WithTagVelocity_ShouldReturnDtoVelocity()
        {
            Tag tag = VelocityTag(value: 12);

            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.ShouldHaveValues(
                type: typeof(byte).ToString(),
                name: "Velocity",
                value: "12",
                unit: "m/s",
                comment: "Ruuuun!",
                key: "Velocity");
        }
        public void WithTag_ShouldReturnDto()
        {
            Tag tag = Tag(
                dataType: IEC61131_3_DataTypes.Int,
                name: "Throughput",
                value: 2100,
                unit: "Shirts",
                comment: "Shirts, baby");

            TagDtoAssembler assembler = CreateAssembler();
            TagDTO          dto       = assembler.Assemble(tag);

            dto.ShouldHaveValues(
                type: typeof(short).ToString(),
                name: "Throughput",
                value: "2100",
                unit: "Shirts",
                comment: "Shirts, baby",
                key: "Throughput");
        }