Bläddra i källkod

Add SettingsServiceTest (initial)

Dalibor Votruba 3 år sedan
förälder
incheckning
4c2e609721

+ 1 - 2
Common/qdr.app.qlbrc.common/Settings/ModuleSetting.cs

@@ -1,5 +1,4 @@
-using System.Reflection;
-using Quadarax.Foundation.Core.Data.Interface.Entity;
+using Quadarax.Foundation.Core.Data.Interface.Entity;
 using Quadarax.Foundation.Core.Object.Extensions;
 using Quadarax.Foundation.Core.Reflection.Extensions;
 

+ 0 - 1
Modules/qdr.app.qlbrc.base/Services/SettingsService.cs

@@ -53,7 +53,6 @@ namespace Quadarax.Application.QLiberace.Base.Services
                     Repository.Set(setting);
                 }
 
-                //Repository.Commit();
                 return new ResultPlain();
             });
         }

+ 20 - 0
Tests/qdr.app.qlbrc.base.Tests/Services/Fakes/LoggerFactoryFake.cs

@@ -0,0 +1,20 @@
+using Microsoft.Extensions.Logging;
+
+namespace Quadarax.Application.QLiberace.Base.Tests.Services.Fakes
+{
+    public class LoggerFactoryFake : ILoggerFactory
+    {
+        public void Dispose()
+        {
+        }
+
+        public ILogger CreateLogger(string categoryName)
+        {
+            return new LoggerFake();
+        }
+
+        public void AddProvider(ILoggerProvider provider)
+        {
+        }
+    }
+}

+ 21 - 0
Tests/qdr.app.qlbrc.base.Tests/Services/Fakes/LoggerFake.cs

@@ -0,0 +1,21 @@
+using Microsoft.Extensions.Logging;
+
+namespace Quadarax.Application.QLiberace.Base.Tests.Services.Fakes
+{
+    public class LoggerFake : ILogger
+    {
+        public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
+        {
+        }
+
+        public bool IsEnabled(LogLevel logLevel)
+        {
+            return false;
+        }
+
+        public IDisposable BeginScope<TState>(TState state)
+        {
+            return null;
+        }
+    }
+}

+ 112 - 2
Tests/qdr.app.qlbrc.base.Tests/Services/SettingsServiceTest.cs

@@ -1,7 +1,7 @@
 using qdr.fnd.core.test;
 using Quadarax.Application.QLiberace.Base.Repositories;
 using Quadarax.Application.QLiberace.Base.Services;
-using Quadarax.Foundation.Core.Data;
+using Quadarax.Application.QLiberace.Base.Tests.Services.Fakes;
 using Quadarax.Foundation.Core.Data.Domain;
 
 namespace Quadarax.Application.QLiberace.Base.Tests.Services
@@ -17,7 +17,117 @@ namespace Quadarax.Application.QLiberace.Base.Tests.Services
 
         protected override SettingsService GetService()
         {
-            return new SettingsService(GetRepository(), null, null);
+            return new SettingsService(GetRepository(), null, new LoggerFactoryFake());
         }
+
+
+        [Test]
+        public void CreateSettingsOK()
+        {
+
+        }
+
+        [Test]
+        public void CreateSettingsFail()
+        {
+
+        }
+
+        [Test]
+        public void GetSettingsOK()
+        {
+
+        }
+
+        [Test]
+        public void GetSettingsFail()
+        {
+
+        }
+
+        [Test]
+        public void GetSettingsValueOK()
+        {
+
+        }
+
+        [Test]
+        public void GetSettingsValueFail()
+        {
+
+        }
+
+
+        [Test]
+        public void ExistsSettingsValueOK()
+        {
+
+        }
+
+        [Test]
+        public void ExistsSettingsValueFail()
+        {
+
+        }
+
+        [Test]
+        public void AddSettingsValueOK()
+        {
+
+        }
+
+        [Test]
+        public void AddSettingsValueFail()
+        {
+
+        }
+
+        [Test]
+        public void UpdateSettingsOK()
+        {
+
+        }
+
+        [Test]
+        public void UpdateSettingsFail()
+        {
+
+        }
+
+        [Test]
+        public void UpdateSettingsValueOK()
+        {
+
+        }
+
+        [Test]
+        public void UpdateSettingsValueFail()
+        {
+
+        }
+
+        [Test]
+        public void AddOrUpdateSettingsValueOK()
+        {
+
+        }
+
+        [Test]
+        public void AddOrUpdateSettingsValueFail()
+        {
+
+        }
+
+        [Test]
+        public void GetSettingsValuesOK()
+        {
+
+        }
+        [Test]
+        public void GetSettingsValuesFail()
+        {
+
+        }
+
     }
 }