Ejemplo n.º 1
0
        public void TestQueryString()
        {
            BarCodeSettings settings = SettingsUtils.CreateTestSettings();

            string queryString = QueryStringSerializer.ToQueryString(settings);

            StringAssert.Contains(MakePair(QueryStringSerializer.TYPE_KEY, settings.Type), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.DATA_KEY, settings.Data), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.UNIT_KEY, settings.Unit), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.DPI_KEY, settings.Dpi), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.BACKCOLOR_KEY, settings.BackColor.ToArgb()), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.BARCOLOR_KEY, settings.BarColor.ToArgb()), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.BARHEIGHT_KEY, settings.BarHeight), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.FONTCOLOR_KEY, settings.FontColor.ToArgb()), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.GUARDEXTRAHEIGHT_KEY, settings.GuardExtraHeight), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.MODULEWIDTH_KEY, settings.ModuleWidth), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.NARROWWIDTH_KEY, settings.NarrowWidth), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.WIDEWIDTH_KEY, settings.WideWidth), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.OFFSETHEIGHT_KEY, settings.OffsetHeight), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.OFFSETWIDTH_KEY, settings.OffsetWidth), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.FONT_KEY, (string)new FontConverter().ConvertTo(settings.Font, typeof(string))), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.TEXTPOSITION_KEY, settings.TextPosition), queryString);
            StringAssert.Contains(MakePair(QueryStringSerializer.USECHECKSUM_KEY, settings.UseChecksum), queryString);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Makes a <see cref="BarCodeGenerator"/> with valid settings.
        /// </summary>
        /// <returns>Valid barcode generator.</returns>
        private BarCodeGenerator MakeValidGenerator()
        {
            BarCodeSettings settings = SettingsUtils.CreateTestSettings();

            return(new BarCodeGenerator(settings));
        }