|
|
@@ -1,43 +1,23 @@
|
|
|
-using Quadarax.Application.QLiberace.Base.Repositories;
|
|
|
-using Quadarax.Application.QLiberace.Common.Configuration;
|
|
|
+using qdr.fnd.core.test;
|
|
|
+using Quadarax.Application.QLiberace.Base.Repositories;
|
|
|
+using Quadarax.Application.QLiberace.Base.Services;
|
|
|
using Quadarax.Foundation.Core.Data;
|
|
|
using Quadarax.Foundation.Core.Data.Domain;
|
|
|
-using Quadarax.Foundation.Core.Data.Interface.Domain;
|
|
|
|
|
|
namespace Quadarax.Application.QLiberace.Base.Tests.Services
|
|
|
{
|
|
|
[TestFixture(Category = "Srv")]
|
|
|
- public class SettingsServiceTest
|
|
|
+ public class SettingsServiceTest : ServiceDbContextTest<SettingsService, RepoSetting, BaseInMemoryDbContext>
|
|
|
{
|
|
|
- private const string CfgFileName = "qlbrc.test.json";
|
|
|
-
|
|
|
- private IUnitOfWork<BaseInMemoryDbContext> _uow;
|
|
|
-
|
|
|
- [SetUp]
|
|
|
- public void Setup()
|
|
|
+
|
|
|
+ protected override RepoSetting GetRepository()
|
|
|
{
|
|
|
- OlbrcConfiguration.ConfigurationFileName = CfgFileName;
|
|
|
- var context = new BaseInMemoryDbContext();
|
|
|
- context.Database.EnsureCreated();
|
|
|
-
|
|
|
- var doc = (IDomainContextResolver<BaseInMemoryDbContext>)new DomainContextResolver<BaseInMemoryDbContext>(context);
|
|
|
- _uow = new UnitOfWork<BaseInMemoryDbContext>(doc);
|
|
|
+ return new RepoSetting(Uow.As<IDataDomain>());
|
|
|
}
|
|
|
|
|
|
- [Test]
|
|
|
- public void TestMe()
|
|
|
+ protected override SettingsService GetService()
|
|
|
{
|
|
|
- var repo = new RepoSetting(_uow.As<IDataDomain>());
|
|
|
- var newItem = repo.New();
|
|
|
- newItem.Code = "foo";
|
|
|
- newItem.ValueTypeQualified = "System.String";
|
|
|
- newItem.Description = "Test";
|
|
|
- newItem.ModuleCode = "Base";
|
|
|
- newItem.Value = "bar";
|
|
|
- repo.Set(newItem);
|
|
|
- _uow.Commit();
|
|
|
- var fii = repo.Query(Paging.NoPaging(),false).ToArray();
|
|
|
+ return new SettingsService(GetRepository(), null, null);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|