Skip to content

Commit 86942fe

Browse files
committed
- initial release
0 parents  commit 86942fe

26 files changed

Lines changed: 1057 additions & 0 deletions

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
.vs
2+
3+
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
4+
[Bb]in/
5+
[Oo]bj/
6+
[Dd]eployment
7+
.vs
8+
9+
# mstest test results
10+
TestResults
11+
12+
## Ignore Visual Studio temporary files, build results, and
13+
## files generated by popular Visual Studio add-ons.
14+
15+
# User-specific files
16+
*.suo
17+
*.user
18+
*.sln.docstates
19+
20+
# Build results
21+
[Dd]ebug/
22+
[Rr]elease/
23+
x64/
24+
*_i.c
25+
*_p.c
26+
*.ilk
27+
*.meta
28+
*.obj
29+
*.pch
30+
*.pdb
31+
*.pgc
32+
*.pgd
33+
*.rsp
34+
*.sbr
35+
*.tlb
36+
*.tli
37+
*.tlh
38+
*.tmp
39+
*.log
40+
*.vspscc
41+
*.vssscc
42+
.builds
43+
44+
# Visual C++ cache files
45+
ipch/
46+
*.aps
47+
*.ncb
48+
*.opensdf
49+
*.sdf
50+
51+
# Visual Studio profiler
52+
*.psess
53+
*.vsp
54+
*.vspx
55+
56+
# Guidance Automation Toolkit
57+
*.gpState
58+
59+
# ReSharper is a .NET coding add-in
60+
_ReSharper*/
61+
*.[Rr]e[Ss]harper
62+
*.DotSettings.user
63+
*.DotSettings
64+
65+
# NCrunch
66+
*.ncrunch*
67+
.*crunch*.local.xml
68+
69+
# Installshield output folder
70+
[Ee]xpress
71+
72+
# DocProject is a documentation generator add-in
73+
DocProject/buildhelp/
74+
DocProject/Help/*.HxT
75+
DocProject/Help/*.HxC
76+
DocProject/Help/*.hhc
77+
DocProject/Help/*.hhk
78+
DocProject/Help/*.hhp
79+
DocProject/Help/Html2
80+
DocProject/Help/html
81+
82+
# Click-Once directory
83+
publish
84+
85+
# Publish Web Output
86+
*.Publish.xml
87+
88+
# NuGet Packages Directory
89+
packages
90+
91+
# Windows Azure Build Output
92+
csx
93+
*.build.csdef
94+
95+
# Windows Store app package directory
96+
AppPackages/
97+
98+
# Others
99+
[Bb]in
100+
[Oo]bj
101+
sql
102+
TestResults
103+
[Tt]est[Rr]esult*
104+
*.Cache
105+
ClientBin
106+
[Ss]tyle[Cc]op.*
107+
~$*
108+
*.dbmdl
109+
Generated_Code #added for RIA/Silverlight projects
110+
111+
# Backup & report files from converting an old project file to a newer
112+
# Visual Studio version. Backup files are not needed, because we have git ;-)
113+
_UpgradeReport_Files/
114+
Backup*/
115+
UpgradeLog*.XML

.media/logo.png

17.9 KB
Loading

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2018, Eben Roux
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
Redistributions in binary form must reproduce the above copyright notice, this
11+
list of conditions and the following disclaimer in the documentation and/or
12+
other materials provided with the distribution.
13+
14+
Neither the name of the Shuttle organization nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Shuttle.Core.Threading
2+
3+
Provides various classes to facilitate thread-based processing.
4+
5+
Visit the [documentation site](http://shuttle.github.io/shuttle-core/).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
9+
<PackageReference Include="Moq" Version="4.8.0" />
10+
<PackageReference Include="NUnit" Version="3.9.0" />
11+
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Shuttle.Core.Threading\Shuttle.Core.Threading.csproj" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using Moq;
3+
using NUnit.Framework;
4+
5+
namespace Shuttle.Core.Threading.Tests
6+
{
7+
[TestFixture]
8+
public class ThreadActivityFixture
9+
{
10+
[Test]
11+
public void Should_be_able_to_have_the_thread_wait()
12+
{
13+
var activity = new ThreadActivity(new[]
14+
{
15+
TimeSpan.FromMilliseconds(250),
16+
TimeSpan.FromMilliseconds(500)
17+
});
18+
19+
var start = DateTime.Now;
20+
21+
var mockState = new Mock<IThreadState>();
22+
23+
mockState.Setup(mock => mock.Active).Returns(true);
24+
25+
activity.Waiting(mockState.Object);
26+
27+
Assert.IsTrue((DateTime.Now - start).TotalMilliseconds >= 250);
28+
29+
activity.Waiting(mockState.Object);
30+
31+
Assert.IsTrue((DateTime.Now - start).TotalMilliseconds >= 750);
32+
}
33+
}
34+
}

Shuttle.Core.Threading.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27130.2010
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shuttle.Core.Threading", "Shuttle.Core.Threading\Shuttle.Core.Threading.csproj", "{A4E3F5B4-53DF-4875-82DD-26788FB1BFF1}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shuttle.Core.Threading.Tests", "Shuttle.Core.Threading.Tests\Shuttle.Core.Threading.Tests.csproj", "{71945E31-9151-4619-BABD-11168FE17A8A}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{A4E3F5B4-53DF-4875-82DD-26788FB1BFF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{A4E3F5B4-53DF-4875-82DD-26788FB1BFF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{A4E3F5B4-53DF-4875-82DD-26788FB1BFF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{A4E3F5B4-53DF-4875-82DD-26788FB1BFF1}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{71945E31-9151-4619-BABD-11168FE17A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{71945E31-9151-4619-BABD-11168FE17A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{71945E31-9151-4619-BABD-11168FE17A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{71945E31-9151-4619-BABD-11168FE17A8A}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {EFF529D6-8421-4D78-A855-44805774F318}
30+
EndGlobalSection
31+
EndGlobal
14 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ShuttleTasksPath Condition="'$(ShuttleTasksPath)' == ''">Shuttle.MSBuild.dll</ShuttleTasksPath>
5+
</PropertyGroup>
6+
7+
<UsingTask AssemblyFile="$(ShuttleTasksPath)" TaskName="Shuttle.MSBuild.Prompt" />
8+
<UsingTask AssemblyFile="$(ShuttleTasksPath)" TaskName="Shuttle.MSBuild.RegexFindAndReplace" />
9+
<UsingTask AssemblyFile="$(ShuttleTasksPath)" TaskName="Shuttle.MSBuild.SetNugetPackageVersions" />
10+
<UsingTask AssemblyFile="$(ShuttleTasksPath)" TaskName="Shuttle.MSBuild.Zip" />
11+
</Project>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0">
2+
<PropertyGroup>
3+
<DeploymentFolder>deployment</DeploymentFolder>
4+
<PackageName>Shuttle.Core.Threading</PackageName>
5+
<PackageSource Condition="$(PackageSource) == ''">https://www.nuget.org</PackageSource>
6+
</PropertyGroup>
7+
8+
<Import Project="Shuttle.MSBuild.targets" />
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\$(PackageName).csproj" />
12+
</ItemGroup>
13+
14+
<Target Name="Build">
15+
<MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Debug;Platform=AnyCPU"/>
16+
<MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Release;Platform=AnyCPU"/>
17+
</Target>
18+
19+
<Target Name="SemanticVersion">
20+
<Prompt Text="Enter semantic version:" Condition="$(SemanticVersion) == ''">
21+
<Output TaskParameter="UserInput" PropertyName="SemanticVersion" />
22+
</Prompt>
23+
24+
<Error Text="Please enter a version number." Condition="$(SemanticVersion) == ''" />
25+
26+
<ItemGroup>
27+
<AssemblyInfoFiles Include="..\Properties\AssemblyInfo.cs" />
28+
</ItemGroup>
29+
30+
<RegexFindAndReplace Files="@(AssemblyInfoFiles)" FindExpression="AssemblyInformationalVersion\s*\(\s*&quot;.*&quot;\s*\)" ReplacementText="AssemblyInformationalVersion(&quot;$(SemanticVersion)&quot;)" />
31+
<RegexFindAndReplace Files="@(AssemblyInfoFiles)" FindExpression="AssemblyVersion\s*\(\s*&quot;.*&quot;\s*\)" ReplacementText="AssemblyVersion(&quot;$(SemanticVersion).0&quot;)" />
32+
</Target>
33+
34+
<Target Name="Deploy" DependsOnTargets="SemanticVersion">
35+
<MSBuild
36+
Projects="$(MSBuildProjectFile)"
37+
Targets="Package"
38+
Properties="SemanticVersion=$(SemanticVersion)"
39+
/>
40+
41+
<Exec Command="nuget push $(DeploymentFolder)\nuget\$(PackageName).$(SemanticVersion).nupkg -source $(PackageSource)" />
42+
<Exec Command="git commit -a -m &quot;- v$(SemanticVersion)&quot;" />
43+
<Exec Command="git push" />
44+
</Target>
45+
46+
<Target Name="Package" DependsOnTargets="SemanticVersion;Build">
47+
<ItemGroup>
48+
<NugetBinaries Include="..\bin\debug\**\$(PackageName).dll" />
49+
</ItemGroup>
50+
51+
<Copy SourceFiles="package.nuspec" DestinationFolder="$(DeploymentFolder)\nuget\" SkipUnchangedFiles="false" />
52+
<Copy SourceFiles="@(NugetBinaries)" DestinationFolder="$(DeploymentFolder)\nuget\lib\%(RecursiveDir)" SkipUnchangedFiles="false" />
53+
54+
<RegexFindAndReplace Files="$(DeploymentFolder)\nuget\package.nuspec" FindExpression="\{semver\}" ReplacementText="$(SemanticVersion)" />
55+
<RegexFindAndReplace Files="$(DeploymentFolder)\nuget\package.nuspec" FindExpression="\{year\}" ReplacementText="$([System.DateTime]::Now.ToString(`yyyy`))" />
56+
<SetNugetPackageVersions Files="$(DeploymentFolder)\nuget\package.nuspec" ProjectFile="..\$(PackageName).csproj" />
57+
58+
<Exec Command="nuget pack $(DeploymentFolder)\nuget\package.nuspec -OutputDirectory $(DeploymentFolder)\nuget -NoPackageAnalysis" />
59+
60+
<MakeDir Directories="$(NugetPackageSourceFolder)" Condition="$(NugetPackageSourceFolder) != ''" />
61+
62+
<Copy
63+
SourceFiles="$(DeploymentFolder)\nuget\$(PackageName).$(SemanticVersion).nupkg"
64+
DestinationFolder="$(NugetPackageSourceFolder)"
65+
SkipUnchangedFiles="false"
66+
Condition="$(NugetPackageSourceFolder) != ''" />
67+
</Target>
68+
</Project>

0 commit comments

Comments
 (0)