diff --git a/phirSOFT.JobManager.Core.Test/JobManagerTest.cs b/phirSOFT.JobManager.Core.Test/JobManagerTest.cs
new file mode 100644
index 0000000..c9866e7
--- /dev/null
+++ b/phirSOFT.JobManager.Core.Test/JobManagerTest.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+namespace phirSOFT.JobManager.Core.Test
+{
+ [TestFixture]
+ class JobManagerTest
+ {
+
+ [Test]
+ public void TestOverAllStatus()
+ {
+ var manager = new JobManager();
+
+ Assert.AreEqual(false, manager.CanDisplayOverallProgress);
+ Assert.AreEqual(JobStatus.Succeded, manager.OverallStatus);
+ }
+ }
+}
diff --git a/phirSOFT.JobManager.Core.Test/Properties/AssemblyInfo.cs b/phirSOFT.JobManager.Core.Test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..0b6013e
--- /dev/null
+++ b/phirSOFT.JobManager.Core.Test/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("phirSOFT.JobManager.Core.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("phirSOFT.JobManager.Core.Test")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("359e1e52-ac74-41c4-976c-a57ac4235a00")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/phirSOFT.JobManager.Core.Test/packages.config b/phirSOFT.JobManager.Core.Test/packages.config
new file mode 100644
index 0000000..feb054d
--- /dev/null
+++ b/phirSOFT.JobManager.Core.Test/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/phirSOFT.JobManager.Core.Test/phirSOFT.JobManager.Core.Test.csproj b/phirSOFT.JobManager.Core.Test/phirSOFT.JobManager.Core.Test.csproj
new file mode 100644
index 0000000..d17707c
--- /dev/null
+++ b/phirSOFT.JobManager.Core.Test/phirSOFT.JobManager.Core.Test.csproj
@@ -0,0 +1,68 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {359E1E52-AC74-41C4-976C-A57AC4235A00}
+ Library
+ Properties
+ phirSOFT.JobManager.Core.Test
+ phirSOFT.JobManager.Core.Test
+ v4.6
+ 512
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {3ce51311-b126-4aca-82b2-9875362c1ece}
+ phirSOFT.JobManager.Core
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
\ No newline at end of file
diff --git a/phirSOFT.JobManager.Core/JobManager.cs b/phirSOFT.JobManager.Core/JobManager.cs
index b09d4ad..ce125f4 100644
--- a/phirSOFT.JobManager.Core/JobManager.cs
+++ b/phirSOFT.JobManager.Core/JobManager.cs
@@ -31,8 +31,8 @@ public JobManager()
JobFinishedHandler = (sender, args) =>
{
- if (((IJob) sender).Status == JobStatus.Succeded)
- DeregisterJob((IJob) sender);
+ if (((IJob)sender).Status == JobStatus.Succeded)
+ DeregisterJob((IJob)sender);
};
_statusConverter = new JobStatusComparator();
@@ -81,8 +81,13 @@ public JobStatus OverallStatus
using (var enumerator = _registredJobs.GetEnumerator())
{
if (!enumerator.MoveNext())
+ {
+ _registredJobsLock.ExitReadLock();
return JobStatus.Succeded;
+ }
+
+
Debug.Assert(enumerator.Current != null, "enumerator.Current != null");
max = enumerator.Current.Status;
while (enumerator.MoveNext())
@@ -92,7 +97,7 @@ public JobStatus OverallStatus
max = enumerator.Current.Status;
}
}
-
+ _registredJobsLock.ExitReadLock();
return max;
}
}
@@ -152,7 +157,7 @@ IEnumerator IEnumerable.GetEnumerator()
private void OnJobPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- var job = (IJob) sender;
+ var job = (IJob)sender;
switch (e.PropertyName)
{
diff --git a/phirSOFT.JobManager.sln b/phirSOFT.JobManager.sln
index 7648d04..9363d7d 100644
--- a/phirSOFT.JobManager.sln
+++ b/phirSOFT.JobManager.sln
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "phirSOFT.JobManager.Core",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "phirSOFT.JobManager.Wpf", "phirSOFT.JobManager.Wpf\phirSOFT.JobManager.Wpf.csproj", "{A369D84E-7BB2-4F89-B1F2-07FCE871E783}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "phirSOFT.JobManager.Core.Test", "phirSOFT.JobManager.Core.Test\phirSOFT.JobManager.Core.Test.csproj", "{359E1E52-AC74-41C4-976C-A57AC4235A00}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{A369D84E-7BB2-4F89-B1F2-07FCE871E783}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A369D84E-7BB2-4F89-B1F2-07FCE871E783}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A369D84E-7BB2-4F89-B1F2-07FCE871E783}.Release|Any CPU.Build.0 = Release|Any CPU
+ {359E1E52-AC74-41C4-976C-A57AC4235A00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {359E1E52-AC74-41C4-976C-A57AC4235A00}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {359E1E52-AC74-41C4-976C-A57AC4235A00}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {359E1E52-AC74-41C4-976C-A57AC4235A00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE