GenerateJsonSchemaTest.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using Edge.Core.Processor.Dispatcher;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace Edge.Core.Test
  7. {
  8. [TestClass]
  9. public class GenerateJsonSchemaTest
  10. {
  11. public class PumpGroupParameter
  12. {
  13. public enum PumpModelEnum
  14. {
  15. // for all cases, this type of dispenser, like totalizer, amount, price data fields and etc., has smaller value range
  16. Model_664 = 0,
  17. // for all cases, this type of dispenser, like totalizer, amount, price data fields and etc., has wider value range
  18. Model_886 = 1
  19. }
  20. public enum PumpAuthorizeModeEnum
  21. {
  22. /// <summary>
  23. /// in this mode, dispenser need get fc authorized then can start fueling.
  24. /// </summary>
  25. FC_Authorize = 0,
  26. /// <summary>
  27. /// in this mode, dispenser can start fueling without authorize from fc, so lift nozzle, fueling start.
  28. /// </summary>
  29. Pump_Self_Authorize = 1,
  30. }
  31. public class PumpParameter
  32. {
  33. public int PumpId { get; set; }
  34. /// <summary>
  35. /// setup in physical dispenser side.
  36. /// </summary>
  37. public byte Address { get; set; }
  38. public PumpModelEnum? PumpModel { get; set; } = PumpModelEnum.Model_664;
  39. public PumpAuthorizeModeEnum? PumpAuthorizeMode { get; set; } = PumpAuthorizeModeEnum.FC_Authorize;
  40. public int? AmountDecimalDigits { get; set; } = 2;
  41. public int? VolumeDecimalDigits { get; set; } = 2;
  42. public int? PriceDecimalDigits { get; set; } = 2;
  43. public int? VolumeTotalizerDecimalDigits { get; set; } = 2;
  44. }
  45. public IEnumerable<PumpParameter> PumpParameters { get; set; }
  46. }
  47. [TestMethod]
  48. public void TestMethod2()
  49. {
  50. var s = ObjectInstanceCreator.GetJsonSchemaString(typeof(PumpGroupParameter));
  51. }
  52. [TestMethod]
  53. public void TestMethod3()
  54. {
  55. var s = ObjectInstanceCreator.GetJsonSchemaString(new List<Type>() { typeof(PumpGroupParameter), typeof(string) });
  56. }
  57. }
  58. }