SettingsServiceTest.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Quadarax.Application.QLiberace.Base.Repositories;
  2. using Quadarax.Application.QLiberace.Common.Configuration;
  3. using Quadarax.Foundation.Core.Data;
  4. using Quadarax.Foundation.Core.Data.Domain;
  5. using Quadarax.Foundation.Core.Data.Interface.Domain;
  6. namespace Quadarax.Application.QLiberace.Base.Tests.Services
  7. {
  8. [TestFixture(Category = "Srv")]
  9. public class SettingsServiceTest
  10. {
  11. private const string CfgFileName = "qlbrc.test.json";
  12. private IUnitOfWork<BaseInMemoryDbContext> _uow;
  13. [SetUp]
  14. public void Setup()
  15. {
  16. OlbrcConfiguration.ConfigurationFileName = CfgFileName;
  17. var context = new BaseInMemoryDbContext();
  18. context.Database.EnsureCreated();
  19. var doc = (IDomainContextResolver<BaseInMemoryDbContext>)new DomainContextResolver<BaseInMemoryDbContext>(context);
  20. _uow = new UnitOfWork<BaseInMemoryDbContext>(doc);
  21. }
  22. [Test]
  23. public void TestMe()
  24. {
  25. var repo = new RepoSetting(_uow.As<IDataDomain>());
  26. var newItem = repo.New();
  27. newItem.Code = "foo";
  28. newItem.ValueTypeQualified = "System.String";
  29. newItem.Description = "Test";
  30. newItem.ModuleCode = "Base";
  31. newItem.Value = "bar";
  32. repo.Set(newItem);
  33. _uow.Commit();
  34. var fii = repo.Query(Paging.NoPaging(),false).ToArray();
  35. }
  36. }
  37. }