absolutely horrendous

This commit is contained in:
femsci 2023-11-18 05:59:32 +01:00
parent 60c896acd1
commit 24ba0f6314
Signed by: femsci
GPG key ID: 08F7911F0E650C67
7 changed files with 92 additions and 24 deletions

View file

@ -21,14 +21,11 @@ public class GenerationTests
UmoDocument doc = new(UmoDoctype.CONTR_EMPLOYMENT, ModelEmployer, ModelEmployee);
UmoProcess proc = new(eng);
var enu = proc.Ask("I would like to employ Jan Kowalski ID NO CBS3727348 for part time job as a shopkeeper.");
await foreach (var str in enu)
{
Console.Write(str);
}
Console.WriteLine("~");
// var enu = proc.Ask("I would like to employ Jan Kowalski ID NO CBS3727348 for part time job as a shopkeeper and pay 1400zł.");
// await foreach (var str in enu)
// {
// Console.Write(str);
// }
}
}

View file

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Nyanlabs.Umogen.Core;
using Nyanlabs.Umogen.Core.Models;
namespace Nyanlabs.Umogen.CoreTests;
public class PdfTest
{
private Person ModelEmployer => new("Kotek", "Miauczyński", "CBS4327563", "04281308999", new DateTime(2004, 08, 13));
private Person ModelEmployee => new("Miau", "Kotczyński", "CBS69696969", "76011694336", new DateTime(1976, 1, 16));
[Fact]
public async void RenderBoi()
{
// Given
string root = Environment.CurrentDirectory.Replace("test/Nyanlabs.Umogen.WebTests/bin/Debug/net8.0", "");
UmoEngine eng = new(Path.Combine(root, Core.Umogen.DEFAULT_API_KEY_FILE));
UmoProcess p = new(eng);
StringBuilder sb = new();
await foreach (var str in p.Ask($"Zatrudnij {ModelEmployee.NLQuerySerialize()} jako programistę z wynagrodzeniem 12137zł."))
{
Console.Write(str);
sb.Append(str);
}
var anal = JsonSerializer.Deserialize<UmoAnalModel>(sb.ToString(), Core.Umogen.JSON_OPTS);
UmoDocumentResult r = new(null, ModelEmployer, ModelEmployee, ValidTime.Invalid, 2137, anal);
// When
byte[] b = await r.ProcessPdf(Path.Combine(root, $"templates/{r.DocType.TemplateDoc()}"));
// Then
await File.WriteAllBytesAsync(Path.Combine(root, "out.pdf"), b);
}
}