コード例 #1
0
        public void ZebraDetailFactory_PopulateWithTwoBackImageFields_SecondBackPanelFieldSetCorrectly()
        {
            // Arrange
            var zebraDetailFactory = new ZebraDetailFactory();

            ProductField[] productFields = new ProductField[]
            {
                new ProductField {
                    Deleted = false, Editable = false, Printable = true, PrintSide = 1, Width = 100, Height = 200, ProductPrintFieldTypeId = 1,
                    X       = 15, Y = 30, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 1")
                },
                new ProductField {
                    Deleted = false, Editable = false, Printable = true, PrintSide = 1, Width = 430, Height = 789, ProductPrintFieldTypeId = 1,
                    X       = 20, Y = 52, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 2")
                }
            };

            var secondField      = productFields[1];
            var secondImageField = new ZebraCardImageDetail(secondField.Value, secondField.X, secondField.Y, secondField.Width, secondField.Height);

            // Act
            var simPrintDetails = zebraDetailFactory.Populate(productFields);

            // Assert
            simPrintDetails.BackPanelImages[1].Should().BeEquivalentTo(secondImageField);
        }
コード例 #2
0
        public void ZebraDetailFactory_PopulateWithMixedFields_BackPanelFieldSetCorrectly()
        {
            // Arrange
            var zebraDetailFactory = new ZebraDetailFactory();

            ProductField[] productFields = new ProductField[]
            {
                new ProductField {
                    Deleted       = false, Editable = false, Printable = true, Font = "consolas", PrintSide = 0, ProductPrintFieldTypeId = 0,
                    FontColourRGB = Color.Black.ToArgb(), FontSize = 10, X = 15, Y = 30, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 1")
                },
                new ProductField {
                    Deleted       = false, Editable = false, Printable = true, Font = "arial", PrintSide = 1, ProductPrintFieldTypeId = 0,
                    FontColourRGB = Color.Red.ToArgb(), FontSize = 12, X = 20, Y = 52, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 2")
                },
                new ProductField {
                    Deleted = false, Editable = false, Printable = true, PrintSide = 0, Width = 100, Height = 200, ProductPrintFieldTypeId = 1,
                    X       = 43, Y = 66, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 3")
                },
                new ProductField {
                    Deleted = false, Editable = false, Printable = true, PrintSide = 1, Width = 430, Height = 789, ProductPrintFieldTypeId = 1,
                    X       = 5, Y = 9, Value = Encoding.UTF8.GetBytes("Hello From Print Sim field 4")
                }
            };

            var firstField     = productFields[1];
            var firstTextField = new ZebraCardTextDetail(firstField.ValueToString(), firstField.X, firstField.Y, firstField.Font,
                                                         firstField.FontSize, firstField.FontColourRGB, FontStyle.Regular);
            var secondField     = productFields[3];
            var secondTextField = new ZebraCardImageDetail(secondField.Value, secondField.X, secondField.Y, secondField.Width, secondField.Height);

            // Act
            var simPrintDetails = zebraDetailFactory.Populate(productFields);

            // Assert
            simPrintDetails.BackPanelText[0].Should().BeEquivalentTo(firstTextField);
            simPrintDetails.BackPanelImages[0].Should().BeEquivalentTo(secondTextField);
        }