ModuleSettingsTest.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using Quadarax.Application.QLiberace.Common.Tests.Settings.Fakes;
  2. namespace Quadarax.Application.QLiberace.Common.Tests.Settings
  3. {
  4. public class ModuleSettingsTest
  5. {
  6. private ModuleSettingFake _setting;
  7. [SetUp]
  8. public void Setup()
  9. {
  10. _setting = new ModuleSettingFake();
  11. }
  12. [Test]
  13. public void GetData()
  14. {
  15. //TODO: fix test
  16. var data = _setting.GetData().ToArray();
  17. Assert.That(data.Length, Is.EqualTo(7));
  18. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyString1", string.Empty, ModuleSettingFake.DefPropertyString1));
  19. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyString2", string.Empty, ModuleSettingFake.DefPropertyString2));
  20. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyDateTime1", string.Empty, string.IsNullOrEmpty(ModuleSettingFake.DefPropertyDateTime1String)
  21. ? (DateTime?)null
  22. : DateTime.Parse(ModuleSettingFake.DefPropertyDateTime1String!)));
  23. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyDateTime2", string.Empty, string.IsNullOrEmpty(ModuleSettingFake.DefPropertyDateTime2String)
  24. ? (DateTime?)null
  25. : DateTime.Parse(ModuleSettingFake.DefPropertyDateTime2String!)));
  26. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyTimeSpan", string.Empty, string.IsNullOrEmpty(ModuleSettingFake.DefPropertyTimeSpanString)
  27. ? (TimeSpan?)null
  28. : TimeSpan.Parse(ModuleSettingFake.DefPropertyTimeSpanString!)));
  29. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyInt", string.Empty, ModuleSettingFake.DefPropertyInt));
  30. CollectionAssert.Contains(data,new Tuple<string, string, object?>("PropertyBool", string.Empty, ModuleSettingFake.DefPropertyBool));
  31. }
  32. }
  33. }