public async Task Kitchen_FullyCancelled() { var model = new KitchenModel() { isFood = true, @case = new CaseModel() { id = 1, packageId = 1, itemId = 1, createdByEmployeeName = "Andreas", note = "19:30", arrived = new DateTime(2020, 3, 17, 17, 41, 0).ToString("o"), departed = null }, itemName = " 3", sequenceNumber = 1, printedByEmployeeName = "Andreas", printed = new DateTime(2020, 3, 17, 17, 41, 0).ToString("o"), isCancellation = true, added = { }, changed = { }, removed = { } }; var result = await _generator.GenerateDocumentAsync(_script, model, null); var expected = new byte[] { 0x1B, 0x40, 0x1B, 0x1D, 0x74, 0x20, // HEADER 0x1B, 0x69, 0x01, 0x01, 0x1B, 0x44, 0x0B, 0x00, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, 0x20, 0x61, 0x66, // "Startet af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x2E, 0x20, 0x61, 0x66, // "Udskr. af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x42, 0x6F, 0x6E, 0x20, 0x6E, 0x72, 0x2E, // "Bon nr." 0x09, 0x31, // "1" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, // "Startet" 0x09, 0x31, 0x37, 0x3A, 0x34, 0x31, // "17:41" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x31, 0x37, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 17/03-2020" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x65, 0x76, 0x65, 0x74, // "Udskrevet" 0x09, 0x31, 0x37, 0x3A, 0x34, 0x31, // "17:41" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x31, 0x37, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 17/03-2020" 0x0A, 0x1B, 0x69, 0x02, 0x02, 0x20, 0x33, // " 3" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // CANCEL 0x1B, 0x69, 0x02, 0x02, 0x46, 0x55, 0x4C, 0x44, 0x54, 0x20, 0x41, 0x4E, 0x4E, 0x55, 0x4C, 0x45, 0x52, 0x45, 0x54, 0x21, // "FULDT ANNULERET!" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x0A, // FOOTER 0x31, 0x39, 0x3A, 0x33, 0x30, // "19:30" 0x0A, // TAIL 0x0A, 0x0A, 0x0A, 0x1B, 0x64, 0x00 }; Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content)); }
public async Task Kitchen_New() { var model = new KitchenModel() { isFood = true, @case = new CaseModel() { id = 1, packageId = 1, itemId = 1, createdByEmployeeName = "Andreas", note = null, arrived = new DateTime(2020, 3, 22, 15, 45, 0).ToString("o"), departed = null, }, itemName = " 1", sequenceNumber = 1, printedByEmployeeName = "Andreas", printed = new DateTime(2020, 3, 22, 15, 45, 0).ToString("o"), isCancellation = false, added = { new KitchenModel.Line() { quantity = 7, name = "Burger UAH" }, new KitchenModel.Line() { quantity = 2, name = "Stjerneskud UAH" }, new KitchenModel.Line() { quantity = 4, name = "Wienerschnitzel UAH" } }, changed = { }, removed = { } }; var result = await _generator.GenerateDocumentAsync(_script, model, null); var expected = new byte[] { 0x1B, 0x40, 0x1B, 0x1D, 0x74, 0x20, // HEADER 0x1B, 0x69, 0x01, 0x01, 0x1B, 0x44, 0x0B, 0x00, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, 0x20, 0x61, 0x66, // "Startet af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x2E, 0x20, 0x61, 0x66, // "Udskr. af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x42, 0x6F, 0x6E, 0x20, 0x6E, 0x72, 0x2E, // "Bon nr." 0x09, 0x31, // "1" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, // "Startet" 0x09, 0x31, 0x35, 0x3A, 0x34, 0x35, // "15:45" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x32, 0x32, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 22/03-2020" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x65, 0x76, 0x65, 0x74, // "Udskrevet" 0x09, 0x31, 0x35, 0x3A, 0x34, 0x35, // "15:45" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x32, 0x32, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 22/03-2020" 0x0A, 0x1B, 0x69, 0x02, 0x02, 0x20, 0x31, // " 1" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // DIFF 0x1B, 0x44, 0x07, 0x00, 0x1B, 0x69, 0x01, 0x01, 0x37, // "7" 0x09, 0x1B, 0x69, 0x01, 0x01, 0x42, 0x75, 0x72, 0x67, 0x65, 0x72, 0x20, 0x55, 0x41, 0x48, // "Burger UAH" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x32, // "2" 0x09, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x6A, 0x65, 0x72, 0x6E, 0x65, 0x73, 0x6B, 0x75, 0x64, 0x20, 0x55, 0x41, 0x48, // "Stjerneskud UAH" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x34, // "4" 0x09, 0x1B, 0x69, 0x01, 0x01, 0x57, 0x69, 0x65, 0x6E, 0x65, 0x72, 0x73, 0x63, 0x68, 0x6E, 0x69, 0x74, 0x7A, 0x65, 0x6C, 0x20, 0x55, // "Wienerschnitzel U" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // Tail 0x0A, 0x0A, 0x0A, 0x1B, 0x64, 0x00 }; Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content)); }
public async Task Kitchen_Removed() { var model = new KitchenModel() { isFood = true, @case = new CaseModel() { id = 1, packageId = 1, itemId = 1, createdByEmployeeName = "Lisbeth", note = null, arrived = new DateTime(2020, 3, 6, 18, 12, 0).ToString("o"), departed = null, }, itemName = " 4", sequenceNumber = 2, printedByEmployeeName = "Lisbeth", printed = new DateTime(2020, 3, 6, 19, 46, 0).ToString("o"), isCancellation = false, added = { new KitchenModel.Line() { quantity = null, name = "Vent", note = null }, new KitchenModel.Line() { quantity = 1, name = "Petit fours", note = null } }, removed = { new KitchenModel.Line() { quantity = null, name = "Vent", note = null } } }; var result = await _generator.GenerateDocumentAsync(_script, model, null); var expected = new byte[] { 0x1B, 0x40, 0x1B, 0x1D, 0x74, 0x20, 0x1B, 0x69, 0x01, 0x01, 0x1B, 0x44, 0x0B, 0x00, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, 0x20, 0x61, 0x66, // "Startet af" 0x09, 0x4C, 0x69, 0x73, 0x62, 0x65, 0x74, 0x68, // "Lisbeth" 0x0A, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x2E, 0x20, 0x61, 0x66, // "Udskr. af" 0x09, 0x4C, 0x69, 0x73, 0x62, 0x65, 0x74, 0x68, // "Lisbeth" 0x0A, 0x42, 0x6F, 0x6E, 0x20, 0x6E, 0x72, 0x2E, // "Bon nr." 0x09, 0x32, // "2" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, // "Startet" 0x09, 0x31, 0x38, 0x3A, 0x31, 0x32, // "18:12" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x30, 0x36, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // "06/03-2020" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x65, 0x76, 0x65, 0x74, // "Udskrevet" 0x09, 0x31, 0x39, 0x3A, 0x34, 0x36, // "19:46" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x30, 0x36, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // "06/03-2020" 0x0A, 0x1B, 0x69, 0x02, 0x02, 0x20, 0x34, // " 04" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // DIFF 0x1B, 0x44, 0x07, 0x00, 0x1B, 0x69, 0x02, 0x02, 0x54, 0x49, 0x4C, 0x46, 0xD8, 0x4A, 0x45, 0x54, // "TILFØJET" 0x1B, 0x69, 0x01, 0x01, 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x56, 0x65, 0x6E, 0x74, // "Vent" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x2B, 0x31, // "+1" 0x09, 0x1B, 0x69, 0x01, 0x01, 0x50, 0x65, 0x74, 0x69, 0x74, 0x20, 0x66, 0x6F, 0x75, 0x72, 0x73, // "Petit fours" 0x0A, 0x1B, 0x69, 0x02, 0x02, 0x41, 0x4E, 0x4E, 0x55, 0x4C, 0x45, 0x52, 0x45, 0x54, // "ANNULERET" 0x1B, 0x69, 0x01, 0x01, 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x56, 0x65, 0x6E, 0x74, // "Vent" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // TAIL 0x0A, 0x0A, 0x0A, 0x1B, 0x64, 0x00 }; Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content)); }
public async Task Kitchen_Changed() { var model = new KitchenModel() { isFood = true, @case = new CaseModel() { id = 1, packageId = 1, itemId = 1, createdByEmployeeName = "Andreas", note = null, arrived = new DateTime(2020, 3, 12, 15, 21, 0).ToString("o"), departed = null, }, itemName = " 1", sequenceNumber = 2, printedByEmployeeName = "Andreas", printed = new DateTime(2020, 3, 17, 17, 31, 0).ToString("o"), isCancellation = false, added = { }, changed = { new KitchenModel.LineDifference() { baseline = new KitchenModel.Line() { quantity = 2, name = "Stjerneskud UAH", note = null }, target = new KitchenModel.Line() { quantity = 2, name = "Stjerneskud UAH", note = " ulla 19:30" }, } }, removed = { } }; var result = await _generator.GenerateDocumentAsync(_script, model, null); var expected = new byte[] { 0x1B, 0x40, 0x1B, 0x1D, 0x74, 0x20, // HEADER 0x1B, 0x69, 0x01, 0x01, 0x1B, 0x44, 0x0B, 0x00, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, 0x20, 0x61, 0x66, // "Startet af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x2E, 0x20, 0x61, 0x66, // "Udskr. af" 0x09, 0x41, 0x6E, 0x64, 0x72, 0x65, 0x61, 0x73, // "Andreas" 0x0A, 0x42, 0x6F, 0x6E, 0x20, 0x6E, 0x72, 0x2E, // "Bon nr." 0x09, 0x32, // "2" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x74, // "Startet" 0x09, 0x31, 0x35, 0x3A, 0x32, 0x31, // "15:21" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x31, 0x32, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 12/03-2020" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x55, 0x64, 0x73, 0x6B, 0x72, 0x65, 0x76, 0x65, 0x74, // "Udskrevet" 0x09, 0x31, 0x37, 0x3A, 0x33, 0x31, // "17:31" 0x1B, 0x69, 0x00, 0x00, 0x20, 0x31, 0x37, 0x2F, 0x30, 0x33, 0x2D, 0x32, 0x30, 0x32, 0x30, // " 17/03-2020" 0x0A, 0x1B, 0x69, 0x02, 0x02, 0x20, 0x31, // " 1" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // DIFF 0x1B, 0x44, 0x07, 0x00, 0x1B, 0x69, 0x02, 0x02, 0xC6, 0x4E, 0x44, 0x52, 0x45, 0x54, // "ÆNDRET" 0x1B, 0x69, 0x01, 0x01, 0x0A, 0x1B, 0x69, 0x00, 0x00, 0x32, // "2" 0x1B, 0x69, 0x01, 0x01, 0x2B, 0x30, // "+0" 0x1B, 0x69, 0x00, 0x00, 0x3D, 0x1B, 0x69, 0x01, 0x01, 0x32, // "2" 0x09, 0x1B, 0x69, 0x01, 0x01, 0x53, 0x74, 0x6A, 0x65, 0x72, 0x6E, 0x65, 0x73, 0x6B, 0x75, 0x64, 0x20, 0x55, 0x41, 0x48, // "Stjerneskud UAH" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x09, 0x20, 0x75, 0x6C, 0x6C, 0x61, 0x20, 0x31, 0x39, 0x3A, 0x33, 0x30, // " ulla 19:30" 0x0A, 0x1B, 0x69, 0x01, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x0A, // TAIL 0x0A, 0x0A, 0x0A, 0x1B, 0x64, 0x00 }; Assert.Equal(BitConverter.ToString(expected), BitConverter.ToString(result.Content)); }