public async Task Receipt_New(int asyncLoadDelay)
        {
            var model = new ReceiptModel()
            {
                vendorDataResource = "havnebakken.json",
                slipId             = 317579,
                @case = new CaseModel()
                {
                    id                    = 1538006,
                    packageId             = 1,
                    itemId                = 1,
                    createdByEmployeeName = "Malene",
                    note                  = null,
                    arrived               = new DateTime(2020, 3, 20, 19, 31, 0).ToString("o"),
                    departed              = null,
                },
                lines =
                {
                    new ReceiptModel.Line()
                    {
                        name = "Fish and chips UAH", quantity = 1, unitPrice = 55, discount = 0
                    }
                },
                itemName = " 6",
                printedByEmployeeName = "Malene",
                grossTotal            = 55,
                discountTotal         = 0,
                netTotal     = 55,
                netTaxTotal  = 11,
                netEuroTotal = 7.53m,
                printed      = new DateTime(2020, 3, 20, 19, 31, 0).ToString("o"),
            };

            var resources = new DictionaryResourceManager()
            {
                ["havnebakken.json"] = JsonSerializer.SerializeToUtf8Bytes(new
                {
                    logoResource   = "havnebakken.bmp",
                    address        = "Havnebakken 12",
                    postalCode     = 9940,
                    city           = "Læsø",
                    phone          = 98499009,
                    cvr            = 20041846,
                    email          = "*****@*****.**",
                    logoOffsetLeft = 100
                }),
                ["havnebakken.bmp"] = File.ReadAllBytes("havnebakken.bmp")
            };

            resources.AsyncLoadDelay = TimeSpan.FromMilliseconds(asyncLoadDelay);

            var result = await _generator.GenerateDocumentAsync(_script, model, resources);

            var expected = File.ReadAllBytes(Path.Combine("Expected", "ReceiptStarLinePointOfSaleTypeScriptGeneratorTests.Receipt_New.bin"));

            Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content));
        }
Esempio n. 2
0
        public async Task Receipt_New(int asyncLoadDelay)
        {
            var model = new ReceiptModel()
            {
                vendorDataResource = "laesoecamping.json",
                slipId             = 60558,
                @case = new CaseModel()
                {
                    id                    = 1028947,
                    packageId             = 1,
                    itemId                = 1,
                    createdByEmployeeName = "Karina",
                    note                  = null,
                    arrived               = new DateTime(2016, 5, 8, 8, 27, 0).ToString("o"),
                    departed              = null,
                },
                lines =
                {
                    new ReceiptModel.Line()
                    {
                        name = "Varesalg Butik", quantity = 1, unitPrice = 10, discount = 0
                    },
                    new ReceiptModel.Line()
                    {
                        name = "0,5 Sodavand", quantity = 1, unitPrice = 20, discount = 0
                    },
                    new ReceiptModel.Line()
                    {
                        name = "0,5 Sodavand", quantity = 1, unitPrice = 20, discount = 0
                    },
                    new ReceiptModel.Line()
                    {
                        name = "Varesalg Butik", quantity = 1, unitPrice = 45, discount = 0
                    }
                },
                itemName = "Kasse",
                printedByEmployeeName = "Karina",
                grossTotal            = 95,
                discountTotal         = 0,
                netTotal     = 95,
                netTaxTotal  = 19,
                netEuroTotal = 12.84m,
                printed      = new DateTime(2016, 5, 8, 10, 14, 0).ToString("o"),
            };

            var resources = new DictionaryResourceManager()
            {
                ["laesoecamping.json"] = JsonSerializer.SerializeToUtf8Bytes(new
                {
                    logoResource   = "laesoecamping.bmp",
                    address        = "Agersigen 18a",
                    postalCode     = 9940,
                    city           = "Læsø",
                    phone          = 98499495,
                    cvr            = 31840902,
                    email          = "*****@*****.**",
                    logoOffsetLeft = 100
                }),
                ["laesoecamping.bmp"] = File.ReadAllBytes("laesoecamping.bmp")
            };

            resources.AsyncLoadDelay = TimeSpan.FromMilliseconds(asyncLoadDelay);

            var result = await _generator.GenerateDocumentAsync(_script, model, resources);

            var expected = File.ReadAllBytes(Path.Combine("Expected", "ReceiptEpsonPointOfSaleTypeScriptGeneratorTests.Receipt_New.bin"));

            Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content));
        }