@@ -0,0 +1,80 | |||||
|
1 | <?xml version="1.0" encoding="utf-8"?> | |||
|
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
|
3 | <PropertyGroup> | |||
|
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
|
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
|
6 | <ProductVersion>8.0.30703</ProductVersion> | |||
|
7 | <SchemaVersion>2.0</SchemaVersion> | |||
|
8 | <ProjectGuid>{2BD05F84-E067-4B87-9477-FDC2676A21C6}</ProjectGuid> | |||
|
9 | <OutputType>Library</OutputType> | |||
|
10 | <RootNamespace>Implab.Fx.Test</RootNamespace> | |||
|
11 | <AssemblyName>Implab.Fx.Test</AssemblyName> | |||
|
12 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
|
13 | </PropertyGroup> | |||
|
14 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
|
15 | <DebugSymbols>true</DebugSymbols> | |||
|
16 | <DebugType>full</DebugType> | |||
|
17 | <Optimize>false</Optimize> | |||
|
18 | <OutputPath>bin\Debug</OutputPath> | |||
|
19 | <DefineConstants>DEBUG;MONO</DefineConstants> | |||
|
20 | <ErrorReport>prompt</ErrorReport> | |||
|
21 | <WarningLevel>4</WarningLevel> | |||
|
22 | <ConsolePause>false</ConsolePause> | |||
|
23 | </PropertyGroup> | |||
|
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
|
25 | <Optimize>true</Optimize> | |||
|
26 | <OutputPath>bin\Release</OutputPath> | |||
|
27 | <ErrorReport>prompt</ErrorReport> | |||
|
28 | <WarningLevel>4</WarningLevel> | |||
|
29 | <ConsolePause>false</ConsolePause> | |||
|
30 | <DefineConstants>MONO</DefineConstants> | |||
|
31 | </PropertyGroup> | |||
|
32 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' "> | |||
|
33 | <DebugSymbols>true</DebugSymbols> | |||
|
34 | <DebugType>full</DebugType> | |||
|
35 | <Optimize>false</Optimize> | |||
|
36 | <OutputPath>bin\Debug</OutputPath> | |||
|
37 | <DefineConstants>DEBUG;TRACE;NET_4_5;MONO</DefineConstants> | |||
|
38 | <ErrorReport>prompt</ErrorReport> | |||
|
39 | <WarningLevel>4</WarningLevel> | |||
|
40 | <ConsolePause>false</ConsolePause> | |||
|
41 | </PropertyGroup> | |||
|
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' "> | |||
|
43 | <Optimize>true</Optimize> | |||
|
44 | <OutputPath>bin\Release</OutputPath> | |||
|
45 | <DefineConstants>NET_4_5;MONO</DefineConstants> | |||
|
46 | <ErrorReport>prompt</ErrorReport> | |||
|
47 | <WarningLevel>4</WarningLevel> | |||
|
48 | <ConsolePause>false</ConsolePause> | |||
|
49 | </PropertyGroup> | |||
|
50 | <ItemGroup> | |||
|
51 | <Reference Include="System" /> | |||
|
52 | <Reference Include="nunit.framework" /> | |||
|
53 | <Reference Include="System.Windows.Forms" /> | |||
|
54 | <Reference Include="System.Drawing" /> | |||
|
55 | <Reference Include="System.Data" /> | |||
|
56 | </ItemGroup> | |||
|
57 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | |||
|
58 | <ItemGroup> | |||
|
59 | <ProjectReference Include="..\Implab.Fx\Implab.Fx.csproj"> | |||
|
60 | <Project>{06E706F8-6881-43EB-927E-FFC503AF6ABC}</Project> | |||
|
61 | <Name>Implab.Fx</Name> | |||
|
62 | </ProjectReference> | |||
|
63 | <ProjectReference Include="..\Implab\Implab.csproj"> | |||
|
64 | <Project>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</Project> | |||
|
65 | <Name>Implab</Name> | |||
|
66 | </ProjectReference> | |||
|
67 | </ItemGroup> | |||
|
68 | <ItemGroup> | |||
|
69 | <Compile Include="OverlayTest.cs" /> | |||
|
70 | <Compile Include="Properties\AssemblyInfo.cs" /> | |||
|
71 | <Compile Include="Sample\MainForm.Designer.cs" /> | |||
|
72 | <Compile Include="Sample\MainForm.cs" /> | |||
|
73 | <Compile Include="Sample\OverlayForm.Designer.cs" /> | |||
|
74 | <Compile Include="Sample\OverlayForm.cs" /> | |||
|
75 | </ItemGroup> | |||
|
76 | <ItemGroup> | |||
|
77 | <None Include="Sample\MainForm.resx" /> | |||
|
78 | <None Include="Sample\OverlayForm.resx" /> | |||
|
79 | </ItemGroup> | |||
|
80 | </Project> No newline at end of file |
@@ -0,0 +1,66 | |||||
|
1 | <?xml version="1.0" encoding="utf-8"?> | |||
|
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
|
3 | <PropertyGroup> | |||
|
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
|
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
|
6 | <ProductVersion>8.0.30703</ProductVersion> | |||
|
7 | <SchemaVersion>2.0</SchemaVersion> | |||
|
8 | <ProjectGuid>{2BD05F84-E067-4B87-9477-FDC2676A21C6}</ProjectGuid> | |||
|
9 | <OutputType>Library</OutputType> | |||
|
10 | <RootNamespace>Implab.Test</RootNamespace> | |||
|
11 | <AssemblyName>Implab.Test</AssemblyName> | |||
|
12 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||
|
13 | </PropertyGroup> | |||
|
14 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
|
15 | <DebugSymbols>true</DebugSymbols> | |||
|
16 | <DebugType>full</DebugType> | |||
|
17 | <Optimize>false</Optimize> | |||
|
18 | <OutputPath>bin\Debug</OutputPath> | |||
|
19 | <DefineConstants>DEBUG;MONO</DefineConstants> | |||
|
20 | <ErrorReport>prompt</ErrorReport> | |||
|
21 | <WarningLevel>4</WarningLevel> | |||
|
22 | <ConsolePause>false</ConsolePause> | |||
|
23 | </PropertyGroup> | |||
|
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
|
25 | <Optimize>true</Optimize> | |||
|
26 | <OutputPath>bin\Release</OutputPath> | |||
|
27 | <ErrorReport>prompt</ErrorReport> | |||
|
28 | <WarningLevel>4</WarningLevel> | |||
|
29 | <ConsolePause>false</ConsolePause> | |||
|
30 | <DefineConstants>MONO</DefineConstants> | |||
|
31 | </PropertyGroup> | |||
|
32 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug 4.5|AnyCPU' "> | |||
|
33 | <DebugSymbols>true</DebugSymbols> | |||
|
34 | <DebugType>full</DebugType> | |||
|
35 | <Optimize>false</Optimize> | |||
|
36 | <OutputPath>bin\Debug</OutputPath> | |||
|
37 | <DefineConstants>DEBUG;TRACE;NET_4_5;MONO</DefineConstants> | |||
|
38 | <ErrorReport>prompt</ErrorReport> | |||
|
39 | <WarningLevel>4</WarningLevel> | |||
|
40 | <ConsolePause>false</ConsolePause> | |||
|
41 | </PropertyGroup> | |||
|
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release 4.5|AnyCPU' "> | |||
|
43 | <Optimize>true</Optimize> | |||
|
44 | <OutputPath>bin\Release</OutputPath> | |||
|
45 | <DefineConstants>NET_4_5;MONO</DefineConstants> | |||
|
46 | <ErrorReport>prompt</ErrorReport> | |||
|
47 | <WarningLevel>4</WarningLevel> | |||
|
48 | <ConsolePause>false</ConsolePause> | |||
|
49 | </PropertyGroup> | |||
|
50 | <ItemGroup> | |||
|
51 | <Reference Include="System" /> | |||
|
52 | <Reference Include="nunit.framework" /> | |||
|
53 | </ItemGroup> | |||
|
54 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | |||
|
55 | <ItemGroup> | |||
|
56 | <Compile Include="AsyncTests.cs" /> | |||
|
57 | <Compile Include="PromiseHelper.cs" /> | |||
|
58 | <Compile Include="Properties\AssemblyInfo.cs" /> | |||
|
59 | </ItemGroup> | |||
|
60 | <ItemGroup> | |||
|
61 | <ProjectReference Include="..\Implab\Implab.csproj"> | |||
|
62 | <Project>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</Project> | |||
|
63 | <Name>Implab</Name> | |||
|
64 | </ProjectReference> | |||
|
65 | </ItemGroup> | |||
|
66 | </Project> No newline at end of file |
@@ -0,0 +1,290 | |||||
|
1 | | |||
|
2 | Microsoft Visual Studio Solution File, Format Version 11.00 | |||
|
3 | # Visual Studio 2010 | |||
|
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab", "Implab\Implab.csproj", "{F550F1F8-8746-4AD0-9614-855F4C4B7F05}" | |||
|
5 | EndProject | |||
|
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CE8D8D18-437A-445C-B662-4C2CE79A76F6}" | |||
|
7 | ProjectSection(SolutionItems) = preProject | |||
|
8 | Implab.vsmdi = Implab.vsmdi | |||
|
9 | Local.testsettings = Local.testsettings | |||
|
10 | TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings | |||
|
11 | EndProjectSection | |||
|
12 | EndProject | |||
|
13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx", "Implab.Fx\Implab.Fx.csproj", "{06E706F8-6881-43EB-927E-FFC503AF6ABC}" | |||
|
14 | EndProject | |||
|
15 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BCA337C3-BFDC-4825-BBDB-E6D467E4E452}" | |||
|
16 | EndProject | |||
|
17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Test.mono", "Implab.Test\Implab.Test.mono.csproj", "{2BD05F84-E067-4B87-9477-FDC2676A21C6}" | |||
|
18 | EndProject | |||
|
19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Implab.Fx.Test.mono", "Implab.Fx.Test\Implab.Fx.Test.mono.csproj", "{2BD05F84-E067-4B87-9477-FDC2676A21C6}" | |||
|
20 | EndProject | |||
|
21 | Global | |||
|
22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
|
23 | Debug|Any CPU = Debug|Any CPU | |||
|
24 | Release|Any CPU = Release|Any CPU | |||
|
25 | Debug 4.5|Any CPU = Debug 4.5|Any CPU | |||
|
26 | Release 4.5|Any CPU = Release 4.5|Any CPU | |||
|
27 | EndGlobalSection | |||
|
28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
|
29 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
30 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
31 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
32 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
33 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
34 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
35 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
36 | {06E706F8-6881-43EB-927E-FFC503AF6ABC}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
37 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
38 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
39 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
40 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
41 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
42 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
43 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
44 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
45 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
46 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
47 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
48 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
49 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
50 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
51 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
52 | {2BD05F84-E067-4B87-9477-FDC2676A21C6}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
53 | {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
54 | {2F31E405-E267-4195-A05D-574093C21209}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
55 | {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
56 | {2F31E405-E267-4195-A05D-574093C21209}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
57 | {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
58 | {2F31E405-E267-4195-A05D-574093C21209}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
59 | {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
60 | {2F31E405-E267-4195-A05D-574093C21209}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
61 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
62 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
63 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
64 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
65 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
66 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
67 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
68 | {63F92C0C-61BF-48C0-A377-8D67C3C661D0}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
69 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.ActiveCfg = Debug 4.5|Any CPU | |||
|
70 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug 4.5|Any CPU.Build.0 = Debug 4.5|Any CPU | |||
|
71 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
|
72 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
|
73 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.ActiveCfg = Release 4.5|Any CPU | |||
|
74 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release 4.5|Any CPU.Build.0 = Release 4.5|Any CPU | |||
|
75 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
|
76 | {F550F1F8-8746-4AD0-9614-855F4C4B7F05}.Release|Any CPU.Build.0 = Release|Any CPU | |||
|
77 | EndGlobalSection | |||
|
78 | GlobalSection(NestedProjects) = preSolution | |||
|
79 | {2BD05F84-E067-4B87-9477-FDC2676A21C6} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452} | |||
|
80 | {2BD05F84-E067-4B87-9477-FDC2676A21C6} = {BCA337C3-BFDC-4825-BBDB-E6D467E4E452} | |||
|
81 | EndGlobalSection | |||
|
82 | GlobalSection(MonoDevelopProperties) = preSolution | |||
|
83 | StartupItem = Implab\Implab.csproj | |||
|
84 | Policies = $0 | |||
|
85 | $0.CSharpFormattingPolicy = $1 | |||
|
86 | $1.IndentSwitchBody = True | |||
|
87 | $1.NamespaceBraceStyle = EndOfLine | |||
|
88 | $1.ClassBraceStyle = EndOfLine | |||
|
89 | $1.InterfaceBraceStyle = EndOfLine | |||
|
90 | $1.StructBraceStyle = EndOfLine | |||
|
91 | $1.EnumBraceStyle = EndOfLine | |||
|
92 | $1.MethodBraceStyle = EndOfLine | |||
|
93 | $1.ConstructorBraceStyle = EndOfLine | |||
|
94 | $1.DestructorBraceStyle = EndOfLine | |||
|
95 | $1.BeforeMethodDeclarationParentheses = False | |||
|
96 | $1.BeforeMethodCallParentheses = False | |||
|
97 | $1.BeforeConstructorDeclarationParentheses = False | |||
|
98 | $1.NewLineBeforeConstructorInitializerColon = NewLine | |||
|
99 | $1.NewLineAfterConstructorInitializerColon = SameLine | |||
|
100 | $1.BeforeIndexerDeclarationBracket = False | |||
|
101 | $1.BeforeDelegateDeclarationParentheses = False | |||
|
102 | $1.NewParentheses = False | |||
|
103 | $1.SpacesBeforeBrackets = False | |||
|
104 | $1.inheritsSet = Mono | |||
|
105 | $1.inheritsScope = text/x-csharp | |||
|
106 | $1.scope = text/x-csharp | |||
|
107 | $0.TextStylePolicy = $2 | |||
|
108 | $2.FileWidth = 120 | |||
|
109 | $2.EolMarker = Unix | |||
|
110 | $2.inheritsSet = VisualStudio | |||
|
111 | $2.inheritsScope = text/plain | |||
|
112 | $2.scope = text/x-csharp | |||
|
113 | $0.DotNetNamingPolicy = $3 | |||
|
114 | $3.DirectoryNamespaceAssociation = PrefixedHierarchical | |||
|
115 | $3.ResourceNamePolicy = MSBuild | |||
|
116 | $0.TextStylePolicy = $4 | |||
|
117 | $4.FileWidth = 120 | |||
|
118 | $4.TabsToSpaces = False | |||
|
119 | $4.inheritsSet = VisualStudio | |||
|
120 | $4.inheritsScope = text/plain | |||
|
121 | $4.scope = application/xml | |||
|
122 | $0.XmlFormattingPolicy = $5 | |||
|
123 | $5.inheritsSet = Mono | |||
|
124 | $5.inheritsScope = application/xml | |||
|
125 | $5.scope = application/xml | |||
|
126 | $0.TextStylePolicy = $6 | |||
|
127 | $6.FileWidth = 120 | |||
|
128 | $6.TabsToSpaces = False | |||
|
129 | $6.inheritsSet = VisualStudio | |||
|
130 | $6.inheritsScope = text/plain | |||
|
131 | $6.scope = text/plain | |||
|
132 | $0.NameConventionPolicy = $7 | |||
|
133 | $7.Rules = $8 | |||
|
134 | $8.NamingRule = $9 | |||
|
135 | $9.Name = Namespaces | |||
|
136 | $9.AffectedEntity = Namespace | |||
|
137 | $9.VisibilityMask = VisibilityMask | |||
|
138 | $9.NamingStyle = PascalCase | |||
|
139 | $9.IncludeInstanceMembers = True | |||
|
140 | $9.IncludeStaticEntities = True | |||
|
141 | $8.NamingRule = $10 | |||
|
142 | $10.Name = Types | |||
|
143 | $10.AffectedEntity = Class, Struct, Enum, Delegate | |||
|
144 | $10.VisibilityMask = VisibilityMask | |||
|
145 | $10.NamingStyle = PascalCase | |||
|
146 | $10.IncludeInstanceMembers = True | |||
|
147 | $10.IncludeStaticEntities = True | |||
|
148 | $8.NamingRule = $11 | |||
|
149 | $11.Name = Interfaces | |||
|
150 | $11.RequiredPrefixes = $12 | |||
|
151 | $12.String = I | |||
|
152 | $11.AffectedEntity = Interface | |||
|
153 | $11.VisibilityMask = VisibilityMask | |||
|
154 | $11.NamingStyle = PascalCase | |||
|
155 | $11.IncludeInstanceMembers = True | |||
|
156 | $11.IncludeStaticEntities = True | |||
|
157 | $8.NamingRule = $13 | |||
|
158 | $13.Name = Attributes | |||
|
159 | $13.RequiredSuffixes = $14 | |||
|
160 | $14.String = Attribute | |||
|
161 | $13.AffectedEntity = CustomAttributes | |||
|
162 | $13.VisibilityMask = VisibilityMask | |||
|
163 | $13.NamingStyle = PascalCase | |||
|
164 | $13.IncludeInstanceMembers = True | |||
|
165 | $13.IncludeStaticEntities = True | |||
|
166 | $8.NamingRule = $15 | |||
|
167 | $15.Name = Event Arguments | |||
|
168 | $15.RequiredSuffixes = $16 | |||
|
169 | $16.String = EventArgs | |||
|
170 | $15.AffectedEntity = CustomEventArgs | |||
|
171 | $15.VisibilityMask = VisibilityMask | |||
|
172 | $15.NamingStyle = PascalCase | |||
|
173 | $15.IncludeInstanceMembers = True | |||
|
174 | $15.IncludeStaticEntities = True | |||
|
175 | $8.NamingRule = $17 | |||
|
176 | $17.Name = Exceptions | |||
|
177 | $17.RequiredSuffixes = $18 | |||
|
178 | $18.String = Exception | |||
|
179 | $17.AffectedEntity = CustomExceptions | |||
|
180 | $17.VisibilityMask = VisibilityMask | |||
|
181 | $17.NamingStyle = PascalCase | |||
|
182 | $17.IncludeInstanceMembers = True | |||
|
183 | $17.IncludeStaticEntities = True | |||
|
184 | $8.NamingRule = $19 | |||
|
185 | $19.Name = Methods | |||
|
186 | $19.AffectedEntity = Methods | |||
|
187 | $19.VisibilityMask = VisibilityMask | |||
|
188 | $19.NamingStyle = PascalCase | |||
|
189 | $19.IncludeInstanceMembers = True | |||
|
190 | $19.IncludeStaticEntities = True | |||
|
191 | $8.NamingRule = $20 | |||
|
192 | $20.Name = Static Readonly Fields | |||
|
193 | $20.AffectedEntity = ReadonlyField | |||
|
194 | $20.VisibilityMask = Internal, Protected, Public | |||
|
195 | $20.NamingStyle = PascalCase | |||
|
196 | $20.IncludeInstanceMembers = False | |||
|
197 | $20.IncludeStaticEntities = True | |||
|
198 | $8.NamingRule = $21 | |||
|
199 | $21.Name = Fields (Non Private) | |||
|
200 | $21.AffectedEntity = Field | |||
|
201 | $21.VisibilityMask = Internal, Public | |||
|
202 | $21.NamingStyle = CamelCase | |||
|
203 | $21.IncludeInstanceMembers = True | |||
|
204 | $21.IncludeStaticEntities = True | |||
|
205 | $8.NamingRule = $22 | |||
|
206 | $22.Name = ReadOnly Fields (Non Private) | |||
|
207 | $22.AffectedEntity = ReadonlyField | |||
|
208 | $22.VisibilityMask = Internal, Public | |||
|
209 | $22.NamingStyle = CamelCase | |||
|
210 | $22.IncludeInstanceMembers = True | |||
|
211 | $22.IncludeStaticEntities = False | |||
|
212 | $8.NamingRule = $23 | |||
|
213 | $23.Name = Fields (Private) | |||
|
214 | $23.RequiredPrefixes = $24 | |||
|
215 | $24.String = m_ | |||
|
216 | $23.AffectedEntity = Field, ReadonlyField | |||
|
217 | $23.VisibilityMask = Private, Protected | |||
|
218 | $23.NamingStyle = CamelCase | |||
|
219 | $23.IncludeInstanceMembers = True | |||
|
220 | $23.IncludeStaticEntities = False | |||
|
221 | $8.NamingRule = $25 | |||
|
222 | $25.Name = Static Fields (Private) | |||
|
223 | $25.RequiredPrefixes = $26 | |||
|
224 | $26.String = _ | |||
|
225 | $25.AffectedEntity = Field | |||
|
226 | $25.VisibilityMask = Private | |||
|
227 | $25.NamingStyle = CamelCase | |||
|
228 | $25.IncludeInstanceMembers = False | |||
|
229 | $25.IncludeStaticEntities = True | |||
|
230 | $8.NamingRule = $27 | |||
|
231 | $27.Name = ReadOnly Fields (Private) | |||
|
232 | $27.RequiredPrefixes = $28 | |||
|
233 | $28.String = m_ | |||
|
234 | $27.AffectedEntity = ReadonlyField | |||
|
235 | $27.VisibilityMask = Private, Protected | |||
|
236 | $27.NamingStyle = CamelCase | |||
|
237 | $27.IncludeInstanceMembers = True | |||
|
238 | $27.IncludeStaticEntities = False | |||
|
239 | $8.NamingRule = $29 | |||
|
240 | $29.Name = Constant Fields | |||
|
241 | $29.AffectedEntity = ConstantField | |||
|
242 | $29.VisibilityMask = VisibilityMask | |||
|
243 | $29.NamingStyle = AllUpper | |||
|
244 | $29.IncludeInstanceMembers = True | |||
|
245 | $29.IncludeStaticEntities = True | |||
|
246 | $8.NamingRule = $30 | |||
|
247 | $30.Name = Properties | |||
|
248 | $30.AffectedEntity = Property | |||
|
249 | $30.VisibilityMask = VisibilityMask | |||
|
250 | $30.NamingStyle = PascalCase | |||
|
251 | $30.IncludeInstanceMembers = True | |||
|
252 | $30.IncludeStaticEntities = True | |||
|
253 | $8.NamingRule = $31 | |||
|
254 | $31.Name = Events | |||
|
255 | $31.AffectedEntity = Event | |||
|
256 | $31.VisibilityMask = VisibilityMask | |||
|
257 | $31.NamingStyle = PascalCase | |||
|
258 | $31.IncludeInstanceMembers = True | |||
|
259 | $31.IncludeStaticEntities = True | |||
|
260 | $8.NamingRule = $32 | |||
|
261 | $32.Name = Enum Members | |||
|
262 | $32.AffectedEntity = EnumMember | |||
|
263 | $32.VisibilityMask = VisibilityMask | |||
|
264 | $32.NamingStyle = PascalCase | |||
|
265 | $32.IncludeInstanceMembers = True | |||
|
266 | $32.IncludeStaticEntities = True | |||
|
267 | $8.NamingRule = $33 | |||
|
268 | $33.Name = Parameters | |||
|
269 | $33.AffectedEntity = Parameter, LocalVariable | |||
|
270 | $33.VisibilityMask = VisibilityMask | |||
|
271 | $33.NamingStyle = CamelCase | |||
|
272 | $33.IncludeInstanceMembers = True | |||
|
273 | $33.IncludeStaticEntities = True | |||
|
274 | $8.NamingRule = $34 | |||
|
275 | $34.Name = Type Parameters | |||
|
276 | $34.RequiredPrefixes = $35 | |||
|
277 | $35.String = T | |||
|
278 | $34.AffectedEntity = TypeParameter | |||
|
279 | $34.VisibilityMask = VisibilityMask | |||
|
280 | $34.NamingStyle = PascalCase | |||
|
281 | $34.IncludeInstanceMembers = True | |||
|
282 | $34.IncludeStaticEntities = True | |||
|
283 | EndGlobalSection | |||
|
284 | GlobalSection(TestCaseManagementSettings) = postSolution | |||
|
285 | CategoryFile = Implab.vsmdi | |||
|
286 | EndGlobalSection | |||
|
287 | GlobalSection(SolutionProperties) = preSolution | |||
|
288 | HideSolutionNode = FALSE | |||
|
289 | EndGlobalSection | |||
|
290 | EndGlobal |
@@ -1,35 +1,38 | |||||
1 | using System; |
|
1 | using System.Windows.Forms; | |
2 | using System.Text; |
|
2 | using Implab.Fx.Test.Sample; | |
3 | using System.Collections.Generic; |
|
3 | using Implab.Fx; | |
4 | using System.Linq; |
|
4 | ||
|
5 | #if MONO | |||
|
6 | ||||
|
7 | using NUnit.Framework; | |||
|
8 | using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; | |||
|
9 | using TestMethod = NUnit.Framework.TestAttribute; | |||
|
10 | ||||
|
11 | #else | |||
|
12 | ||||
5 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
13 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
6 | using System.Windows.Forms; |
|
14 | ||
7 | using Implab.Fx.Test.Sample; |
|
15 | #endif | |
8 | using System.Drawing; |
|
|||
9 | using Implab.Fx; |
|
|||
10 |
|
16 | |||
11 | namespace Implab.Fx.Test |
|
17 | namespace Implab.Fx.Test | |
12 | { |
|
18 | { | |
13 | [TestClass] |
|
19 | [TestClass] | |
14 | public class OverlayTest |
|
20 | public class OverlayTest | |
15 | { |
|
21 | { | |
16 | [TestMethod] |
|
22 | [TestMethod] | |
17 | public void TestMethod1() |
|
23 | public void TestMethod1() | |
18 | { |
|
24 | { | |
19 | var mainForm = new MainForm(); |
|
25 | var mainForm = new MainForm(); | |
20 |
|
26 | |||
21 | mainForm.ButtonEvent += (sender, args) => |
|
27 | mainForm.ButtonEvent += (sender, args) => | |
22 | { |
|
28 | { | |
23 | var overlay = new OverlayForm(); |
|
29 | var overlay = new OverlayForm(); | |
24 | mainForm.OverlayFadeIn(overlay).Then( |
|
30 | mainForm.OverlayFadeIn(overlay).Then( | |
25 | o => o.ButtonEvent += (s2, args2) => |
|
31 | o => o.ButtonEvent += (s2, args2) => o.CloseFadeOut() | |
26 | { |
|
|||
27 | o.CloseFadeOut(); |
|
|||
28 | } |
|
|||
29 | ); |
|
32 | ); | |
30 | }; |
|
33 | }; | |
31 |
|
34 | |||
32 | Application.Run(mainForm); |
|
35 | Application.Run(mainForm); | |
33 | } |
|
36 | } | |
34 | } |
|
37 | } | |
35 | } |
|
38 | } |
This diff has been collapsed as it changes many lines, (857 lines changed) Show them Hide them | |||||
@@ -1,423 +1,434 | |||||
1 | using System; |
|
1 | using System; | |
2 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
2 | using System.Reflection; | |
3 |
using System. |
|
3 | using System.Threading; | |
4 | using System.Threading; |
|
4 | using Implab.Parallels; | |
5 | using Implab.Parallels; |
|
5 | ||
6 |
|
6 | #if MONO | ||
7 | namespace Implab.Test { |
|
7 | ||
8 | [TestClass] |
|
8 | using NUnit.Framework; | |
9 | public class AsyncTests { |
|
9 | using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; | |
10 | [TestMethod] |
|
10 | using TestMethod = NUnit.Framework.TestAttribute; | |
11 | public void ResolveTest() { |
|
11 | ||
12 | int res = -1; |
|
12 | #else | |
13 | var p = new Promise<int>(); |
|
13 | ||
14 | p.Then(x => res = x); |
|
14 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
15 | p.Resolve(100); |
|
15 | ||
16 |
|
16 | #endif | ||
17 | Assert.AreEqual(100, res); |
|
17 | ||
18 | } |
|
18 | namespace Implab.Test { | |
19 |
|
19 | [TestClass] | ||
20 | [TestMethod] |
|
20 | public class AsyncTests { | |
21 | public void RejectTest() { |
|
21 | [TestMethod] | |
22 | int res = -1; |
|
22 | public void ResolveTest() { | |
23 | Exception err = null; |
|
23 | int res = -1; | |
24 |
|
24 | var p = new Promise<int>(); | ||
25 | var p = new Promise<int>(); |
|
25 | p.Then(x => res = x); | |
26 |
p. |
|
26 | p.Resolve(100); | |
27 | x => res = x, |
|
27 | ||
28 | e => { |
|
28 | Assert.AreEqual(100, res); | |
29 | err = e; |
|
29 | } | |
30 | return -2; |
|
30 | ||
31 | } |
|
31 | [TestMethod] | |
32 | ); |
|
32 | public void RejectTest() { | |
33 | p.Reject(new ApplicationException("error")); |
|
33 | int res = -1; | |
34 |
|
34 | Exception err = null; | ||
35 | Assert.AreEqual(res, -1); |
|
35 | ||
36 | Assert.AreEqual(err.Message, "error"); |
|
36 | var p = new Promise<int>(); | |
37 |
|
37 | p.Then( | ||
38 | } |
|
38 | x => res = x, | |
39 |
|
39 | e => { | ||
40 | [TestMethod] |
|
40 | err = e; | |
41 | public void CancelExceptionTest() { |
|
41 | return -2; | |
42 | var p = new Promise<bool>(); |
|
42 | } | |
43 |
|
|
43 | ); | |
44 |
|
44 | p.Reject(new ApplicationException("error")); | ||
45 | var p2 = p.Cancelled(() => { |
|
45 | ||
46 | throw new ApplicationException("CANCELLED"); |
|
46 | Assert.AreEqual(res, -1); | |
47 | }); |
|
47 | Assert.AreEqual(err.Message, "error"); | |
48 |
|
48 | |||
49 |
|
|
49 | } | |
50 | p2.Join(); |
|
50 | ||
51 | Assert.Fail(); |
|
51 | [TestMethod] | |
52 | } catch (ApplicationException err) { |
|
52 | public void CancelExceptionTest() { | |
53 | Assert.AreEqual("CANCELLED", err.InnerException.Message); |
|
53 | var p = new Promise<bool>(); | |
54 |
|
|
54 | p.Cancel(); | |
55 |
|
55 | |||
56 | } |
|
56 | var p2 = p.Cancelled(() => { | |
57 |
|
57 | throw new ApplicationException("CANCELLED"); | ||
58 | [TestMethod] |
|
58 | }); | |
59 | public void ContinueOnCancelTest() { |
|
59 | ||
60 | var p = new Promise<bool>(); |
|
60 | try { | |
61 |
p. |
|
61 | p2.Join(); | |
62 |
|
62 | Assert.Fail(); | ||
63 | var p2 = p |
|
63 | } catch (ApplicationException err) { | |
64 | .Cancelled(() => { |
|
64 | Assert.AreEqual("CANCELLED", err.InnerException.Message); | |
65 | throw new ApplicationException("CANCELLED"); |
|
65 | } | |
66 | }) |
|
66 | ||
67 | .Error(e => true); |
|
67 | } | |
68 |
|
68 | |||
69 | Assert.AreEqual(true, p2.Join()); |
|
69 | [TestMethod] | |
70 | } |
|
70 | public void ContinueOnCancelTest() { | |
71 |
|
71 | var p = new Promise<bool>(); | ||
72 | [TestMethod] |
|
72 | p.Cancel(); | |
73 | public void JoinSuccessTest() { |
|
73 | ||
74 |
var p = |
|
74 | var p2 = p | |
75 | p.Resolve(100); |
|
75 | .Cancelled(() => { | |
76 | Assert.AreEqual(p.Join(), 100); |
|
76 | throw new ApplicationException("CANCELLED"); | |
77 | } |
|
77 | }) | |
78 |
|
78 | .Error(e => true); | ||
79 | [TestMethod] |
|
79 | ||
80 | public void JoinFailTest() { |
|
80 | Assert.AreEqual(true, p2.Join()); | |
81 | var p = new Promise<int>(); |
|
81 | } | |
82 | p.Reject(new ApplicationException("failed")); |
|
82 | ||
83 |
|
83 | [TestMethod] | ||
84 | try { |
|
84 | public void JoinSuccessTest() { | |
85 |
|
|
85 | var p = new Promise<int>(); | |
86 | throw new ApplicationException("WRONG!"); |
|
86 | p.Resolve(100); | |
87 | } catch (TargetInvocationException err) { |
|
87 | Assert.AreEqual(p.Join(), 100); | |
88 | Assert.AreEqual(err.InnerException.Message, "failed"); |
|
88 | } | |
89 | } catch { |
|
89 | ||
90 | Assert.Fail("Got wrong excaption"); |
|
90 | [TestMethod] | |
91 | } |
|
91 | public void JoinFailTest() { | |
92 | } |
|
92 | var p = new Promise<int>(); | |
93 |
|
93 | p.Reject(new ApplicationException("failed")); | ||
94 | [TestMethod] |
|
94 | ||
95 | public void MapTest() { |
|
95 | try { | |
96 |
|
|
96 | p.Join(); | |
97 |
|
97 | throw new ApplicationException("WRONG!"); | ||
98 | var p2 = p.Then(x => x.ToString()); |
|
98 | } catch (TargetInvocationException err) { | |
99 | p.Resolve(100); |
|
99 | Assert.AreEqual(err.InnerException.Message, "failed"); | |
100 |
|
100 | } catch { | ||
101 | Assert.AreEqual(p2.Join(), "100"); |
|
101 | Assert.Fail("Got wrong excaption"); | |
102 | } |
|
102 | } | |
103 |
|
103 | } | ||
104 | [TestMethod] |
|
104 | ||
105 | public void FixErrorTest() { |
|
105 | [TestMethod] | |
106 | var p = new Promise<int>(); |
|
106 | public void MapTest() { | |
107 |
|
107 | var p = new Promise<int>(); | ||
108 | var p2 = p.Error(e => 101); |
|
108 | ||
109 |
|
109 | var p2 = p.Then(x => x.ToString()); | ||
110 |
p.Re |
|
110 | p.Resolve(100); | |
111 |
|
111 | |||
112 |
Assert.AreEqual(p2.Join(), |
|
112 | Assert.AreEqual(p2.Join(), "100"); | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | [TestMethod] |
|
115 | [TestMethod] | |
116 |
public void |
|
116 | public void FixErrorTest() { | |
117 |
var p |
|
117 | var p = new Promise<int>(); | |
118 |
|
118 | |||
119 |
var p |
|
119 | var p2 = p.Error(e => 101); | |
120 | var p2 = new Promise<string>(); |
|
120 | ||
121 | p2.Resolve(x.ToString()); |
|
121 | p.Reject(new Exception()); | |
122 | return p2; |
|
122 | ||
123 | }); |
|
123 | Assert.AreEqual(p2.Join(), 101); | |
124 |
|
124 | } | ||
125 | p1.Resolve(100); |
|
125 | ||
126 |
|
126 | [TestMethod] | ||
127 | Assert.AreEqual(p3.Join(), "100"); |
|
127 | public void ChainTest() { | |
128 | } |
|
128 | var p1 = new Promise<int>(); | |
129 |
|
129 | |||
130 | [TestMethod] |
|
130 | var p3 = p1.Chain(x => { | |
131 | public void PoolTest() { |
|
131 | var p2 = new Promise<string>(); | |
132 | var pid = Thread.CurrentThread.ManagedThreadId; |
|
132 | p2.Resolve(x.ToString()); | |
133 | var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); |
|
133 | return p2; | |
134 |
|
134 | }); | ||
135 | Assert.AreNotEqual(pid, p.Join()); |
|
135 | ||
136 | } |
|
136 | p1.Resolve(100); | |
137 |
|
137 | |||
138 | [TestMethod] |
|
138 | Assert.AreEqual(p3.Join(), "100"); | |
139 | public void WorkerPoolSizeTest() { |
|
139 | } | |
140 | var pool = new WorkerPool(5, 10, 0); |
|
140 | ||
141 |
|
141 | [TestMethod] | ||
142 | Assert.AreEqual(5, pool.PoolSize); |
|
142 | public void PoolTest() { | |
143 |
|
143 | var pid = Thread.CurrentThread.ManagedThreadId; | ||
144 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
144 | var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); | |
145 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
145 | ||
146 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
146 | Assert.AreNotEqual(pid, p.Join()); | |
147 |
|
147 | } | ||
148 | Assert.AreEqual(5, pool.PoolSize); |
|
148 | ||
149 |
|
149 | [TestMethod] | ||
150 | for (int i = 0; i < 100; i++) |
|
150 | public void WorkerPoolSizeTest() { | |
151 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
151 | var pool = new WorkerPool(5, 10, 0); | |
152 | Thread.Sleep(200); |
|
152 | ||
153 |
Assert.AreEqual( |
|
153 | Assert.AreEqual(5, pool.PoolSize); | |
154 |
|
154 | |||
155 | pool.Dispose(); |
|
155 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | |
156 | } |
|
156 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | |
157 |
|
157 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | ||
158 | [TestMethod] |
|
158 | ||
159 | public void WorkerPoolCorrectTest() { |
|
159 | Assert.AreEqual(5, pool.PoolSize); | |
160 | var pool = new WorkerPool(0,1000,100); |
|
160 | ||
161 |
|
161 | for (int i = 0; i < 100; i++) | ||
162 | int iterations = 1000; |
|
162 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); | |
163 | int pending = iterations; |
|
163 | Thread.Sleep(200); | |
164 | var stop = new ManualResetEvent(false); |
|
164 | Assert.AreEqual(10, pool.PoolSize); | |
165 |
|
165 | |||
166 | var count = 0; |
|
166 | pool.Dispose(); | |
167 | for (int i = 0; i < iterations; i++) { |
|
167 | } | |
168 | pool |
|
168 | ||
169 | .Invoke(() => 1) |
|
169 | [TestMethod] | |
170 | .Then(x => Interlocked.Add(ref count, x)) |
|
170 | public void WorkerPoolCorrectTest() { | |
171 | .Then(x => Math.Log10(x)) |
|
171 | var pool = new WorkerPool(0,1000,100); | |
172 | .Anyway(() => { |
|
172 | ||
173 | Interlocked.Decrement(ref pending); |
|
173 | const int iterations = 1000; | |
174 |
|
|
174 | int pending = iterations; | |
175 | stop.Set(); |
|
175 | var stop = new ManualResetEvent(false); | |
176 | }); |
|
176 | ||
177 |
|
|
177 | var count = 0; | |
178 |
|
178 | for (int i = 0; i < iterations; i++) { | ||
179 | stop.WaitOne(); |
|
179 | pool | |
180 |
|
180 | .Invoke(() => 1) | ||
181 | Assert.AreEqual(iterations, count); |
|
181 | .Then(x => Interlocked.Add(ref count, x)) | |
182 | Console.WriteLine("Max threads: {0}", pool.MaxRunningThreads); |
|
182 | .Then(x => Math.Log10(x)) | |
183 | pool.Dispose(); |
|
183 | .Anyway(() => { | |
184 |
|
184 | Interlocked.Decrement(ref pending); | ||
185 | } |
|
185 | if (pending == 0) | |
186 |
|
186 | stop.Set(); | ||
187 | [TestMethod] |
|
187 | }); | |
188 | public void WorkerPoolDisposeTest() { |
|
188 | } | |
189 | var pool = new WorkerPool(5, 20); |
|
189 | ||
190 | Assert.AreEqual(5, pool.PoolSize); |
|
190 | stop.WaitOne(); | |
191 | pool.Dispose(); |
|
191 | ||
192 | Thread.Sleep(500); |
|
192 | Assert.AreEqual(iterations, count); | |
193 | Assert.AreEqual(0, pool.PoolSize); |
|
193 | Console.WriteLine("Max threads: {0}", pool.MaxRunningThreads); | |
194 | pool.Dispose(); |
|
194 | pool.Dispose(); | |
195 |
|
|
195 | ||
196 |
|
196 | } | ||
197 | [TestMethod] |
|
197 | ||
198 | public void MTQueueTest() { |
|
198 | [TestMethod] | |
199 | var queue = new MTQueue<int>(); |
|
199 | public void WorkerPoolDisposeTest() { | |
200 | int res; |
|
200 | var pool = new WorkerPool(5, 20); | |
201 |
|
201 | Assert.AreEqual(5, pool.PoolSize); | ||
202 | queue.Enqueue(10); |
|
202 | pool.Dispose(); | |
203 | Assert.IsTrue(queue.TryDequeue(out res)); |
|
203 | Thread.Sleep(500); | |
204 |
Assert.AreEqual( |
|
204 | Assert.AreEqual(0, pool.PoolSize); | |
205 | Assert.IsFalse(queue.TryDequeue(out res)); |
|
205 | pool.Dispose(); | |
206 |
|
206 | } | ||
207 | for (int i = 0; i < 1000; i++) |
|
207 | ||
208 | queue.Enqueue(i); |
|
208 | [TestMethod] | |
209 |
|
209 | public void MTQueueTest() { | ||
210 | for (int i = 0; i < 1000; i++) { |
|
210 | var queue = new MTQueue<int>(); | |
211 | queue.TryDequeue(out res); |
|
211 | int res; | |
212 | Assert.AreEqual(i, res); |
|
212 | ||
213 | } |
|
213 | queue.Enqueue(10); | |
214 |
|
214 | Assert.IsTrue(queue.TryDequeue(out res)); | ||
215 | int writers = 0; |
|
215 | Assert.AreEqual(10, res); | |
216 | int readers = 0; |
|
216 | Assert.IsFalse(queue.TryDequeue(out res)); | |
217 | var stop = new ManualResetEvent(false); |
|
217 | ||
218 |
int |
|
218 | for (int i = 0; i < 1000; i++) | |
219 |
|
219 | queue.Enqueue(i); | ||
220 | int itemsPerWriter = 10000; |
|
220 | ||
221 | int writersCount = 10; |
|
221 | for (int i = 0; i < 1000; i++) { | |
222 |
|
222 | queue.TryDequeue(out res); | ||
223 | for (int i = 0; i < writersCount; i++) { |
|
223 | Assert.AreEqual(i, res); | |
224 | Interlocked.Increment(ref writers); |
|
224 | } | |
225 | var wn = i; |
|
225 | ||
226 | AsyncPool |
|
226 | int writers = 0; | |
227 | .InvokeNewThread(() => { |
|
227 | int readers = 0; | |
228 | for (int ii = 0; ii < itemsPerWriter; ii++) { |
|
228 | var stop = new ManualResetEvent(false); | |
229 | queue.Enqueue(1); |
|
229 | int total = 0; | |
230 | } |
|
230 | ||
231 | return 1; |
|
231 | const int itemsPerWriter = 10000; | |
232 | }) |
|
232 | const int writersCount = 10; | |
233 | .Anyway(() => Interlocked.Decrement(ref writers)); |
|
233 | ||
234 | } |
|
234 | for (int i = 0; i < writersCount; i++) { | |
235 |
|
235 | Interlocked.Increment(ref writers); | ||
236 | for (int i = 0; i < 10; i++) { |
|
236 | AsyncPool | |
237 | Interlocked.Increment(ref readers); |
|
237 | .InvokeNewThread(() => { | |
238 | var wn = i; |
|
238 | for (int ii = 0; ii < itemsPerWriter; ii++) { | |
239 | AsyncPool |
|
239 | queue.Enqueue(1); | |
240 |
|
|
240 | } | |
241 |
|
|
241 | return 1; | |
242 |
|
|
242 | }) | |
243 | while (queue.TryDequeue(out t)) |
|
243 | .Anyway(() => Interlocked.Decrement(ref writers)); | |
244 | Interlocked.Add(ref total, t); |
|
244 | } | |
245 | } while (writers > 0); |
|
245 | ||
246 | return 1; |
|
246 | for (int i = 0; i < 10; i++) { | |
247 | }) |
|
247 | Interlocked.Increment(ref readers); | |
248 |
|
|
248 | AsyncPool | |
249 |
|
|
249 | .InvokeNewThread(() => { | |
250 |
i |
|
250 | int t; | |
251 |
|
|
251 | do { | |
252 | }); |
|
252 | while (queue.TryDequeue(out t)) | |
253 | } |
|
253 | Interlocked.Add(ref total, t); | |
254 |
|
254 | } while (writers > 0); | ||
255 | stop.WaitOne(); |
|
255 | return 1; | |
256 |
|
256 | }) | ||
257 | Assert.AreEqual(itemsPerWriter * writersCount, total); |
|
257 | .Anyway(() => { | |
258 | } |
|
258 | Interlocked.Decrement(ref readers); | |
259 |
|
259 | if (readers == 0) | ||
260 | [TestMethod] |
|
260 | stop.Set(); | |
261 | public void ParallelMapTest() { |
|
261 | }); | |
262 |
|
262 | } | ||
263 | int count = 100000; |
|
263 | ||
264 |
|
264 | stop.WaitOne(); | ||
265 | double[] args = new double[count]; |
|
265 | ||
266 | var rand = new Random(); |
|
266 | Assert.AreEqual(itemsPerWriter * writersCount, total); | |
267 |
|
267 | } | ||
268 | for (int i = 0; i < count; i++) |
|
268 | ||
269 | args[i] = rand.NextDouble(); |
|
269 | [TestMethod] | |
270 |
|
270 | public void ParallelMapTest() { | ||
271 | var t = Environment.TickCount; |
|
271 | ||
272 | var res = args.ParallelMap(x => Math.Sin(x*x), 4).Join(); |
|
272 | const int count = 100000; | |
273 |
|
273 | |||
274 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); |
|
274 | var args = new double[count]; | |
275 |
|
275 | var rand = new Random(); | ||
276 | t = Environment.TickCount; |
|
276 | ||
277 | for (int i = 0; i < count; i++) |
|
277 | for (int i = 0; i < count; i++) | |
278 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); |
|
278 | args[i] = rand.NextDouble(); | |
279 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
279 | ||
280 | } |
|
280 | var t = Environment.TickCount; | |
281 |
|
281 | var res = args.ParallelMap(x => Math.Sin(x*x), 4).Join(); | ||
282 | [TestMethod] |
|
282 | ||
283 | public void ChainedMapTest() { |
|
283 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); | |
284 |
|
284 | |||
285 | using (var pool = new WorkerPool(0,100,100)) { |
|
285 | t = Environment.TickCount; | |
286 | int count = 10000; |
|
286 | for (int i = 0; i < count; i++) | |
287 |
|
287 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); | ||
288 | double[] args = new double[count]; |
|
288 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); | |
289 | var rand = new Random(); |
|
289 | } | |
290 |
|
290 | |||
291 | for (int i = 0; i < count; i++) |
|
291 | [TestMethod] | |
292 | args[i] = rand.NextDouble(); |
|
292 | public void ChainedMapTest() { | |
293 |
|
293 | |||
294 | var t = Environment.TickCount; |
|
294 | using (var pool = new WorkerPool(0,100,100)) { | |
295 | var res = args |
|
295 | const int count = 10000; | |
296 | .ChainedMap( |
|
296 | ||
297 | x => pool.Invoke( |
|
297 | var args = new double[count]; | |
298 | () => Math.Sin(x * x) |
|
298 | var rand = new Random(); | |
299 | ), |
|
299 | ||
300 |
|
|
300 | for (int i = 0; i < count; i++) | |
301 | ) |
|
301 | args[i] = rand.NextDouble(); | |
302 | .Join(); |
|
302 | ||
303 |
|
303 | var t = Environment.TickCount; | ||
304 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); |
|
304 | var res = args | |
305 |
|
305 | .ChainedMap( | ||
306 | t = Environment.TickCount; |
|
306 | // Analysis disable once AccessToDisposedClosure | |
307 | for (int i = 0; i < count; i++) |
|
307 | x => pool.Invoke( | |
308 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); |
|
308 | () => Math.Sin(x * x) | |
309 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
309 | ), | |
310 | Console.WriteLine("Max workers: {0}", pool.MaxRunningThreads); |
|
310 | 4 | |
311 |
|
|
311 | ) | |
312 | } |
|
312 | .Join(); | |
313 |
|
313 | |||
314 | [TestMethod] |
|
314 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); | |
315 | public void ParallelForEachTest() { |
|
315 | ||
316 |
|
316 | t = Environment.TickCount; | ||
317 | int count = 100000; |
|
317 | for (int i = 0; i < count; i++) | |
318 |
|
318 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); | ||
319 | int[] args = new int[count]; |
|
319 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); | |
320 | var rand = new Random(); |
|
320 | Console.WriteLine("Max workers: {0}", pool.MaxRunningThreads); | |
321 |
|
321 | } | ||
322 | for (int i = 0; i < count; i++) |
|
322 | } | |
323 | args[i] = (int)(rand.NextDouble() * 100); |
|
323 | ||
324 |
|
324 | [TestMethod] | ||
325 | int result = 0; |
|
325 | public void ParallelForEachTest() { | |
326 |
|
326 | |||
327 | var t = Environment.TickCount; |
|
327 | const int count = 100000; | |
328 | args.ParallelForEach(x => Interlocked.Add(ref result, x), 4).Join(); |
|
328 | ||
329 |
|
329 | var args = new int[count]; | ||
330 | Console.WriteLine("Iteration complete in {0} ms, result: {1}", Environment.TickCount - t, result); |
|
330 | var rand = new Random(); | |
331 |
|
331 | |||
332 | int result2 = 0; |
|
332 | for (int i = 0; i < count; i++) | |
333 |
|
333 | args[i] = (int)(rand.NextDouble() * 100); | ||
334 | t = Environment.TickCount; |
|
334 | ||
335 |
|
|
335 | int result = 0; | |
336 | result2 += args[i]; |
|
336 | ||
337 | Assert.AreEqual(result2, result); |
|
337 | var t = Environment.TickCount; | |
338 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
338 | args.ParallelForEach(x => Interlocked.Add(ref result, x), 4).Join(); | |
339 | } |
|
339 | ||
340 |
|
340 | Console.WriteLine("Iteration complete in {0} ms, result: {1}", Environment.TickCount - t, result); | ||
341 | [TestMethod] |
|
341 | ||
342 | public void ComplexCase1Test() { |
|
342 | int result2 = 0; | |
343 | var flags = new bool[3]; |
|
343 | ||
344 |
|
344 | t = Environment.TickCount; | ||
345 | // op1 (aync 200ms) => op2 (async 200ms) => op3 (sync map) |
|
345 | for (int i = 0; i < count; i++) | |
346 |
|
346 | result2 += args[i]; | ||
347 | var p = PromiseHelper |
|
347 | Assert.AreEqual(result2, result); | |
348 | .Sleep(200, "Alan") |
|
348 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); | |
349 | .Cancelled(() => flags[0] = true) |
|
349 | } | |
350 | .Chain(x => |
|
350 | ||
351 | PromiseHelper |
|
351 | [TestMethod] | |
352 | .Sleep(200, "Hi, " + x) |
|
352 | public void ComplexCase1Test() { | |
353 | .Then(y => y) |
|
353 | var flags = new bool[3]; | |
354 | .Cancelled(() => flags[1] = true) |
|
354 | ||
355 | ) |
|
355 | // op1 (aync 200ms) => op2 (async 200ms) => op3 (sync map) | |
356 | .Cancelled(() => flags[2] = true); |
|
356 | ||
357 | Thread.Sleep(300); |
|
357 | var step1 = PromiseHelper | |
358 | p.Cancel(); |
|
358 | .Sleep(200, "Alan") | |
359 | try { |
|
359 | .Cancelled(() => flags[0] = true); | |
360 | Assert.AreEqual(p.Join(), "Hi, Alan"); |
|
360 | var p = step1 | |
361 | Assert.Fail("Shouldn't get here"); |
|
361 | .Chain(x => | |
362 | } catch (OperationCanceledException) { |
|
362 | PromiseHelper | |
363 | } |
|
363 | .Sleep(200, "Hi, " + x) | |
364 |
|
364 | .Then(y => y) | ||
365 | Assert.IsFalse(flags[0]); |
|
365 | .Cancelled(() => flags[1] = true) | |
366 | Assert.IsTrue(flags[1]); |
|
366 | ) | |
367 | Assert.IsTrue(flags[2]); |
|
367 | .Cancelled(() => flags[2] = true); | |
368 | } |
|
368 | step1.Join(); | |
369 |
|
369 | p.Cancel(); | ||
370 | [TestMethod] |
|
370 | try { | |
371 | public void ChainedCancel1Test() { |
|
371 | Assert.AreEqual(p.Join(), "Hi, Alan"); | |
372 | // при отмене сцепленной асинхронной операции все обещание должно |
|
372 | Assert.Fail("Shouldn't get here"); | |
373 |
|
|
373 | } catch (OperationCanceledException) { | |
374 | var p = PromiseHelper |
|
374 | } | |
375 | .Sleep(1, "Hi, HAL!") |
|
375 | ||
376 | .Then(x => { |
|
376 | Assert.IsFalse(flags[0]); | |
377 | // запускаем две асинхронные операции |
|
377 | Assert.IsTrue(flags[1]); | |
378 | var result = PromiseHelper.Sleep(1000, "HEM ENABLED!!!"); |
|
378 | Assert.IsTrue(flags[2]); | |
379 | // вторая операция отменяет первую до завершения |
|
379 | } | |
380 | PromiseHelper |
|
380 | ||
381 | .Sleep(100, "HAL, STOP!") |
|
381 | [TestMethod] | |
382 | .Then(() => result.Cancel()); |
|
382 | public void ChainedCancel1Test() { | |
383 | return result; |
|
383 | // при отмене сцепленной асинхронной операции все обещание должно | |
384 | }); |
|
384 | // завершаться ошибкой OperationCanceledException | |
385 | try { |
|
385 | var p = PromiseHelper | |
386 |
|
|
386 | .Sleep(1, "Hi, HAL!") | |
387 | } catch (TargetInvocationException err) { |
|
387 | .Then(x => { | |
388 | Assert.IsTrue(err.InnerException is OperationCanceledException); |
|
388 | // запускаем две асинхронные операции | |
389 | } |
|
389 | var result = PromiseHelper.Sleep(1000, "HEM ENABLED!!!"); | |
390 | } |
|
390 | // вторая операция отменяет первую до завершения | |
391 |
|
391 | PromiseHelper | ||
392 | [TestMethod] |
|
392 | .Sleep(100, "HAL, STOP!") | |
393 | public void ChainedCancel2Test() { |
|
393 | .Then(result.Cancel); | |
394 | // при отмене цепочки обещаний, вложенные операции также должны отменяться |
|
394 | return result; | |
395 | var pSurvive = new Promise<bool>(); |
|
395 | }); | |
396 | var hemStarted = new ManualResetEvent(false); |
|
396 | try { | |
397 | var p = PromiseHelper |
|
397 | p.Join(); | |
398 | .Sleep(1, "Hi, HAL!") |
|
398 | } catch (TargetInvocationException err) { | |
399 | .Chain(x => { |
|
399 | Assert.IsTrue(err.InnerException is OperationCanceledException); | |
400 | hemStarted.Set(); |
|
400 | } | |
401 | // запускаем две асинхронные операции |
|
401 | } | |
402 | var result = PromiseHelper |
|
402 | ||
403 | .Sleep(10000, "HEM ENABLED!!!") |
|
403 | [TestMethod] | |
404 | .Then(s => pSurvive.Resolve(false)); |
|
404 | public void ChainedCancel2Test() { | |
405 |
|
405 | // при отмене цепочки обещаний, вложенные операции также должны отменяться | ||
406 | result |
|
406 | var pSurvive = new Promise<bool>(); | |
407 | .Cancelled(() => pSurvive.Resolve(true)); |
|
407 | var hemStarted = new ManualResetEvent(false); | |
408 |
|
408 | var p = PromiseHelper | ||
409 | return result; |
|
409 | .Sleep(1, "Hi, HAL!") | |
410 |
|
|
410 | .Chain(x => { | |
411 |
|
411 | hemStarted.Set(); | ||
412 | hemStarted.WaitOne(); |
|
412 | // запускаем две асинхронные операции | |
413 | p.Cancel(); |
|
413 | var result = PromiseHelper | |
414 |
|
414 | .Sleep(10000, "HEM ENABLED!!!") | ||
415 | try { |
|
415 | .Then(s => pSurvive.Resolve(false)); | |
416 | p.Join(); |
|
416 | ||
417 | } catch (OperationCanceledException) { |
|
417 | result | |
418 | Assert.IsTrue(pSurvive.Join()); |
|
418 | .Cancelled(() => pSurvive.Resolve(true)); | |
419 |
|
|
419 | ||
420 | } |
|
420 | return result; | |
421 | } |
|
421 | }); | |
422 | } |
|
422 | ||
423 |
|
423 | hemStarted.WaitOne(); | ||
|
424 | p.Cancel(); | |||
|
425 | ||||
|
426 | try { | |||
|
427 | p.Join(); | |||
|
428 | } catch (OperationCanceledException) { | |||
|
429 | Assert.IsTrue(pSurvive.Join()); | |||
|
430 | } | |||
|
431 | } | |||
|
432 | } | |||
|
433 | } | |||
|
434 |
@@ -1,17 +1,13 | |||||
1 | using Implab.Parallels; |
|
1 | using Implab.Parallels; | |
2 | using System; |
|
|||
3 | using System.Collections.Generic; |
|
|||
4 | using System.Linq; |
|
|||
5 | using System.Text; |
|
|||
6 | using System.Threading; |
|
2 | using System.Threading; | |
7 |
|
3 | |||
8 | namespace Implab.Test { |
|
4 | namespace Implab.Test { | |
9 | class PromiseHelper { |
|
5 | static class PromiseHelper { | |
10 | public static IPromise<T> Sleep<T>(int timeout, T retVal) { |
|
6 | public static IPromise<T> Sleep<T>(int timeout, T retVal) { | |
11 | return AsyncPool.Invoke(() => { |
|
7 | return AsyncPool.Invoke(() => { | |
12 | Thread.Sleep(timeout); |
|
8 | Thread.Sleep(timeout); | |
13 | return retVal; |
|
9 | return retVal; | |
14 | }); |
|
10 | }); | |
15 | } |
|
11 | } | |
16 | } |
|
12 | } | |
17 | } |
|
13 | } |
@@ -1,35 +1,34 | |||||
1 | using System.Reflection; |
|
1 | using System.Reflection; | |
2 | using System.Runtime.CompilerServices; |
|
2 | using System.Runtime.CompilerServices; | |
3 | using System.Runtime.InteropServices; |
|
3 | using System.Runtime.InteropServices; | |
4 |
|
4 | |||
5 | // General Information about an assembly is controlled through the following |
|
5 | // General Information about an assembly is controlled through the following | |
6 | // set of attributes. Change these attribute values to modify the information |
|
6 | // set of attributes. Change these attribute values to modify the information | |
7 | // associated with an assembly. |
|
7 | // associated with an assembly. | |
8 | [assembly: AssemblyTitle("Implab.Test")] |
|
8 | [assembly: AssemblyTitle("Implab.Test")] | |
9 | [assembly: AssemblyDescription("")] |
|
9 | [assembly: AssemblyDescription("")] | |
10 | [assembly: AssemblyConfiguration("")] |
|
10 | [assembly: AssemblyConfiguration("")] | |
11 | [assembly: AssemblyCompany("")] |
|
11 | [assembly: AssemblyCompany("")] | |
12 | [assembly: AssemblyProduct("Implab.Test")] |
|
12 | [assembly: AssemblyProduct("Implab.Test")] | |
13 | [assembly: AssemblyCopyright("Copyright © 2013")] |
|
13 | [assembly: AssemblyCopyright("Copyright © 2013")] | |
14 | [assembly: AssemblyTrademark("")] |
|
14 | [assembly: AssemblyTrademark("")] | |
15 | [assembly: AssemblyCulture("")] |
|
15 | [assembly: AssemblyCulture("")] | |
16 |
|
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible |
|
17 | // Setting ComVisible to false makes the types in this assembly not visible | |
18 | // to COM components. If you need to access a type in this assembly from |
|
18 | // to COM components. If you need to access a type in this assembly from | |
19 | // COM, set the ComVisible attribute to true on that type. |
|
19 | // COM, set the ComVisible attribute to true on that type. | |
20 | [assembly: ComVisible(false)] |
|
20 | [assembly: ComVisible(false)] | |
21 |
|
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
|
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | |
23 | [assembly: Guid("bfcae720-21eb-4411-b70a-6eeab99071de")] |
|
23 | [assembly: Guid("bfcae720-21eb-4411-b70a-6eeab99071de")] | |
24 |
|
24 | |||
25 | // Version information for an assembly consists of the following four values: |
|
25 | // Version information for an assembly consists of the following four values: | |
26 | // |
|
26 | // | |
27 | // Major Version |
|
27 | // Major Version | |
28 | // Minor Version |
|
28 | // Minor Version | |
29 | // Build Number |
|
29 | // Build Number | |
30 | // Revision |
|
30 | // Revision | |
31 | // |
|
31 | // | |
32 | // You can specify all the values or you can default the Build and Revision Numbers |
|
32 | // You can specify all the values or you can default the Build and Revision Numbers | |
33 | // by using the '*' as shown below: |
|
33 | // by using the '*' as shown below: | |
34 |
[assembly: AssemblyVersion(" |
|
34 | [assembly: AssemblyVersion("0.0.*")] | |
35 | [assembly: AssemblyFileVersion("1.0.0.0")] |
|
General Comments 0
You need to be logged in to leave comments.
Login now