feat(delmia-notifier): recipe DTOs + JSON source-gen context
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json;
|
||||
using ZB.MOM.WW.ScadaBridge.DelmiaNotifier;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.DelmiaNotifier.Tests;
|
||||
|
||||
public class JsonContractTests
|
||||
{
|
||||
[Fact]
|
||||
public void RecipeDownload_serializes_pascalcase()
|
||||
{
|
||||
var json = JsonSerializer.Serialize(
|
||||
new RecipeDownload { MachineCode = "Z28061", DownloadPath = @"C:\r.nc",
|
||||
WorkOrderNumber = "W1", PartNumber = "P1", JobStepNumber = "0100", Username = "op" },
|
||||
NotifierJsonContext.Default.RecipeDownload);
|
||||
Assert.Contains("\"MachineCode\":\"Z28061\"", json);
|
||||
Assert.Contains("\"DownloadPath\"", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RecipeDownloadResult_deserializes_pascalcase()
|
||||
{
|
||||
var r = JsonSerializer.Deserialize("{\"Result\":true,\"ResultText\":\"ok\"}",
|
||||
NotifierJsonContext.Default.RecipeDownloadResult);
|
||||
Assert.True(r!.Result);
|
||||
Assert.Equal("ok", r.ResultText);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user