@@ -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; | |
|
2 | using System.Text; | |
|
3 | using System.Collections.Generic; | |
|
4 | using System.Linq; | |
|
1 | using System.Windows.Forms; | |
|
2 | using Implab.Fx.Test.Sample; | |
|
3 | using Implab.Fx; | |
|
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 | 13 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
6 | using System.Windows.Forms; | |
|
7 | using Implab.Fx.Test.Sample; | |
|
8 | using System.Drawing; | |
|
9 | using Implab.Fx; | |
|
14 | ||
|
15 | #endif | |
|
10 | 16 | |
|
11 | 17 | namespace Implab.Fx.Test |
|
12 | 18 | { |
|
13 | 19 | [TestClass] |
|
14 | 20 | public class OverlayTest |
|
15 | 21 | { |
|
16 | 22 | [TestMethod] |
|
17 | 23 | public void TestMethod1() |
|
18 | 24 | { |
|
19 | 25 | var mainForm = new MainForm(); |
|
20 | 26 | |
|
21 | 27 | mainForm.ButtonEvent += (sender, args) => |
|
22 | 28 | { |
|
23 | 29 | var overlay = new OverlayForm(); |
|
24 | 30 | mainForm.OverlayFadeIn(overlay).Then( |
|
25 | o => o.ButtonEvent += (s2, args2) => | |
|
26 | { | |
|
27 | o.CloseFadeOut(); | |
|
28 | } | |
|
31 | o => o.ButtonEvent += (s2, args2) => o.CloseFadeOut() | |
|
29 | 32 | ); |
|
30 | 33 | }; |
|
31 | 34 | |
|
32 | 35 | Application.Run(mainForm); |
|
33 | 36 | } |
|
34 | 37 | } |
|
35 | 38 | } |
@@ -1,423 +1,434 | |||
|
1 | 1 | using System; |
|
2 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
|
3 | 2 | using System.Reflection; |
|
4 | 3 | using System.Threading; |
|
5 | 4 | using Implab.Parallels; |
|
6 | 5 | |
|
6 | #if MONO | |
|
7 | ||
|
8 | using NUnit.Framework; | |
|
9 | using TestClassAttribute = NUnit.Framework.TestFixtureAttribute; | |
|
10 | using TestMethod = NUnit.Framework.TestAttribute; | |
|
11 | ||
|
12 | #else | |
|
13 | ||
|
14 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
|
15 | ||
|
16 | #endif | |
|
17 | ||
|
7 | 18 | namespace Implab.Test { |
|
8 | 19 | [TestClass] |
|
9 | 20 | public class AsyncTests { |
|
10 | 21 | [TestMethod] |
|
11 | 22 | public void ResolveTest() { |
|
12 | 23 | int res = -1; |
|
13 | 24 | var p = new Promise<int>(); |
|
14 | 25 | p.Then(x => res = x); |
|
15 | 26 | p.Resolve(100); |
|
16 | 27 | |
|
17 | 28 | Assert.AreEqual(100, res); |
|
18 | 29 | } |
|
19 | 30 | |
|
20 | 31 | [TestMethod] |
|
21 | 32 | public void RejectTest() { |
|
22 | 33 | int res = -1; |
|
23 | 34 | Exception err = null; |
|
24 | 35 | |
|
25 | 36 | var p = new Promise<int>(); |
|
26 | 37 | p.Then( |
|
27 | 38 | x => res = x, |
|
28 | 39 | e => { |
|
29 | 40 | err = e; |
|
30 | 41 | return -2; |
|
31 | 42 | } |
|
32 | 43 | ); |
|
33 | 44 | p.Reject(new ApplicationException("error")); |
|
34 | 45 | |
|
35 | 46 | Assert.AreEqual(res, -1); |
|
36 | 47 | Assert.AreEqual(err.Message, "error"); |
|
37 | 48 | |
|
38 | 49 | } |
|
39 | 50 | |
|
40 | 51 | [TestMethod] |
|
41 | 52 | public void CancelExceptionTest() { |
|
42 | 53 | var p = new Promise<bool>(); |
|
43 | 54 | p.Cancel(); |
|
44 | 55 | |
|
45 | 56 | var p2 = p.Cancelled(() => { |
|
46 | 57 | throw new ApplicationException("CANCELLED"); |
|
47 | 58 | }); |
|
48 | 59 | |
|
49 | 60 | try { |
|
50 | 61 | p2.Join(); |
|
51 | 62 | Assert.Fail(); |
|
52 | 63 | } catch (ApplicationException err) { |
|
53 | 64 | Assert.AreEqual("CANCELLED", err.InnerException.Message); |
|
54 | 65 | } |
|
55 | 66 | |
|
56 | 67 | } |
|
57 | 68 | |
|
58 | 69 | [TestMethod] |
|
59 | 70 | public void ContinueOnCancelTest() { |
|
60 | 71 | var p = new Promise<bool>(); |
|
61 | 72 | p.Cancel(); |
|
62 | 73 | |
|
63 | 74 | var p2 = p |
|
64 | 75 | .Cancelled(() => { |
|
65 | 76 | throw new ApplicationException("CANCELLED"); |
|
66 | 77 | }) |
|
67 | 78 | .Error(e => true); |
|
68 | 79 | |
|
69 | 80 | Assert.AreEqual(true, p2.Join()); |
|
70 | 81 | } |
|
71 | 82 | |
|
72 | 83 | [TestMethod] |
|
73 | 84 | public void JoinSuccessTest() { |
|
74 | 85 | var p = new Promise<int>(); |
|
75 | 86 | p.Resolve(100); |
|
76 | 87 | Assert.AreEqual(p.Join(), 100); |
|
77 | 88 | } |
|
78 | 89 | |
|
79 | 90 | [TestMethod] |
|
80 | 91 | public void JoinFailTest() { |
|
81 | 92 | var p = new Promise<int>(); |
|
82 | 93 | p.Reject(new ApplicationException("failed")); |
|
83 | 94 | |
|
84 | 95 | try { |
|
85 | 96 | p.Join(); |
|
86 | 97 | throw new ApplicationException("WRONG!"); |
|
87 | 98 | } catch (TargetInvocationException err) { |
|
88 | 99 | Assert.AreEqual(err.InnerException.Message, "failed"); |
|
89 | 100 | } catch { |
|
90 | 101 | Assert.Fail("Got wrong excaption"); |
|
91 | 102 | } |
|
92 | 103 | } |
|
93 | 104 | |
|
94 | 105 | [TestMethod] |
|
95 | 106 | public void MapTest() { |
|
96 | 107 | var p = new Promise<int>(); |
|
97 | 108 | |
|
98 | 109 | var p2 = p.Then(x => x.ToString()); |
|
99 | 110 | p.Resolve(100); |
|
100 | 111 | |
|
101 | 112 | Assert.AreEqual(p2.Join(), "100"); |
|
102 | 113 | } |
|
103 | 114 | |
|
104 | 115 | [TestMethod] |
|
105 | 116 | public void FixErrorTest() { |
|
106 | 117 | var p = new Promise<int>(); |
|
107 | 118 | |
|
108 | 119 | var p2 = p.Error(e => 101); |
|
109 | 120 | |
|
110 | 121 | p.Reject(new Exception()); |
|
111 | 122 | |
|
112 | 123 | Assert.AreEqual(p2.Join(), 101); |
|
113 | 124 | } |
|
114 | 125 | |
|
115 | 126 | [TestMethod] |
|
116 | 127 | public void ChainTest() { |
|
117 | 128 | var p1 = new Promise<int>(); |
|
118 | 129 | |
|
119 | 130 | var p3 = p1.Chain(x => { |
|
120 | 131 | var p2 = new Promise<string>(); |
|
121 | 132 | p2.Resolve(x.ToString()); |
|
122 | 133 | return p2; |
|
123 | 134 | }); |
|
124 | 135 | |
|
125 | 136 | p1.Resolve(100); |
|
126 | 137 | |
|
127 | 138 | Assert.AreEqual(p3.Join(), "100"); |
|
128 | 139 | } |
|
129 | 140 | |
|
130 | 141 | [TestMethod] |
|
131 | 142 | public void PoolTest() { |
|
132 | 143 | var pid = Thread.CurrentThread.ManagedThreadId; |
|
133 | 144 | var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); |
|
134 | 145 | |
|
135 | 146 | Assert.AreNotEqual(pid, p.Join()); |
|
136 | 147 | } |
|
137 | 148 | |
|
138 | 149 | [TestMethod] |
|
139 | 150 | public void WorkerPoolSizeTest() { |
|
140 | 151 | var pool = new WorkerPool(5, 10, 0); |
|
141 | 152 | |
|
142 | 153 | Assert.AreEqual(5, pool.PoolSize); |
|
143 | 154 | |
|
144 | 155 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
145 | 156 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
146 | 157 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
147 | 158 | |
|
148 | 159 | Assert.AreEqual(5, pool.PoolSize); |
|
149 | 160 | |
|
150 | 161 | for (int i = 0; i < 100; i++) |
|
151 | 162 | pool.Invoke(() => { Thread.Sleep(100000000); return 10; }); |
|
152 | 163 | Thread.Sleep(200); |
|
153 | 164 | Assert.AreEqual(10, pool.PoolSize); |
|
154 | 165 | |
|
155 | 166 | pool.Dispose(); |
|
156 | 167 | } |
|
157 | 168 | |
|
158 | 169 | [TestMethod] |
|
159 | 170 | public void WorkerPoolCorrectTest() { |
|
160 | 171 | var pool = new WorkerPool(0,1000,100); |
|
161 | 172 | |
|
162 | int iterations = 1000; | |
|
173 | const int iterations = 1000; | |
|
163 | 174 | int pending = iterations; |
|
164 | 175 | var stop = new ManualResetEvent(false); |
|
165 | 176 | |
|
166 | 177 | var count = 0; |
|
167 | 178 | for (int i = 0; i < iterations; i++) { |
|
168 | 179 | pool |
|
169 | 180 | .Invoke(() => 1) |
|
170 | 181 | .Then(x => Interlocked.Add(ref count, x)) |
|
171 | 182 | .Then(x => Math.Log10(x)) |
|
172 | 183 | .Anyway(() => { |
|
173 | 184 | Interlocked.Decrement(ref pending); |
|
174 | 185 | if (pending == 0) |
|
175 | 186 | stop.Set(); |
|
176 | 187 | }); |
|
177 | 188 | } |
|
178 | 189 | |
|
179 | 190 | stop.WaitOne(); |
|
180 | 191 | |
|
181 | 192 | Assert.AreEqual(iterations, count); |
|
182 | 193 | Console.WriteLine("Max threads: {0}", pool.MaxRunningThreads); |
|
183 | 194 | pool.Dispose(); |
|
184 | 195 | |
|
185 | 196 | } |
|
186 | 197 | |
|
187 | 198 | [TestMethod] |
|
188 | 199 | public void WorkerPoolDisposeTest() { |
|
189 | 200 | var pool = new WorkerPool(5, 20); |
|
190 | 201 | Assert.AreEqual(5, pool.PoolSize); |
|
191 | 202 | pool.Dispose(); |
|
192 | 203 | Thread.Sleep(500); |
|
193 | 204 | Assert.AreEqual(0, pool.PoolSize); |
|
194 | 205 | pool.Dispose(); |
|
195 | 206 | } |
|
196 | 207 | |
|
197 | 208 | [TestMethod] |
|
198 | 209 | public void MTQueueTest() { |
|
199 | 210 | var queue = new MTQueue<int>(); |
|
200 | 211 | int res; |
|
201 | 212 | |
|
202 | 213 | queue.Enqueue(10); |
|
203 | 214 | Assert.IsTrue(queue.TryDequeue(out res)); |
|
204 | 215 | Assert.AreEqual(10, res); |
|
205 | 216 | Assert.IsFalse(queue.TryDequeue(out res)); |
|
206 | 217 | |
|
207 | 218 | for (int i = 0; i < 1000; i++) |
|
208 | 219 | queue.Enqueue(i); |
|
209 | 220 | |
|
210 | 221 | for (int i = 0; i < 1000; i++) { |
|
211 | 222 | queue.TryDequeue(out res); |
|
212 | 223 | Assert.AreEqual(i, res); |
|
213 | 224 | } |
|
214 | 225 | |
|
215 | 226 | int writers = 0; |
|
216 | 227 | int readers = 0; |
|
217 | 228 | var stop = new ManualResetEvent(false); |
|
218 | 229 | int total = 0; |
|
219 | 230 | |
|
220 | int itemsPerWriter = 10000; | |
|
221 | int writersCount = 10; | |
|
231 | const int itemsPerWriter = 10000; | |
|
232 | const int writersCount = 10; | |
|
222 | 233 | |
|
223 | 234 | for (int i = 0; i < writersCount; i++) { |
|
224 | 235 | Interlocked.Increment(ref writers); |
|
225 | var wn = i; | |
|
226 | 236 | AsyncPool |
|
227 | 237 | .InvokeNewThread(() => { |
|
228 | 238 | for (int ii = 0; ii < itemsPerWriter; ii++) { |
|
229 | 239 | queue.Enqueue(1); |
|
230 | 240 | } |
|
231 | 241 | return 1; |
|
232 | 242 | }) |
|
233 | 243 | .Anyway(() => Interlocked.Decrement(ref writers)); |
|
234 | 244 | } |
|
235 | 245 | |
|
236 | 246 | for (int i = 0; i < 10; i++) { |
|
237 | 247 | Interlocked.Increment(ref readers); |
|
238 | var wn = i; | |
|
239 | 248 | AsyncPool |
|
240 | 249 | .InvokeNewThread(() => { |
|
241 | 250 | int t; |
|
242 | 251 | do { |
|
243 | 252 | while (queue.TryDequeue(out t)) |
|
244 | 253 | Interlocked.Add(ref total, t); |
|
245 | 254 | } while (writers > 0); |
|
246 | 255 | return 1; |
|
247 | 256 | }) |
|
248 | 257 | .Anyway(() => { |
|
249 | 258 | Interlocked.Decrement(ref readers); |
|
250 | 259 | if (readers == 0) |
|
251 | 260 | stop.Set(); |
|
252 | 261 | }); |
|
253 | 262 | } |
|
254 | 263 | |
|
255 | 264 | stop.WaitOne(); |
|
256 | 265 | |
|
257 | 266 | Assert.AreEqual(itemsPerWriter * writersCount, total); |
|
258 | 267 | } |
|
259 | 268 | |
|
260 | 269 | [TestMethod] |
|
261 | 270 | public void ParallelMapTest() { |
|
262 | 271 | |
|
263 | int count = 100000; | |
|
272 | const int count = 100000; | |
|
264 | 273 | |
|
265 |
|
|
|
274 | var args = new double[count]; | |
|
266 | 275 | var rand = new Random(); |
|
267 | 276 | |
|
268 | 277 | for (int i = 0; i < count; i++) |
|
269 | 278 | args[i] = rand.NextDouble(); |
|
270 | 279 | |
|
271 | 280 | var t = Environment.TickCount; |
|
272 | 281 | var res = args.ParallelMap(x => Math.Sin(x*x), 4).Join(); |
|
273 | 282 | |
|
274 | 283 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); |
|
275 | 284 | |
|
276 | 285 | t = Environment.TickCount; |
|
277 | 286 | for (int i = 0; i < count; i++) |
|
278 | 287 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); |
|
279 | 288 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
280 | 289 | } |
|
281 | 290 | |
|
282 | 291 | [TestMethod] |
|
283 | 292 | public void ChainedMapTest() { |
|
284 | 293 | |
|
285 | 294 | using (var pool = new WorkerPool(0,100,100)) { |
|
286 | int count = 10000; | |
|
295 | const int count = 10000; | |
|
287 | 296 | |
|
288 |
|
|
|
297 | var args = new double[count]; | |
|
289 | 298 | var rand = new Random(); |
|
290 | 299 | |
|
291 | 300 | for (int i = 0; i < count; i++) |
|
292 | 301 | args[i] = rand.NextDouble(); |
|
293 | 302 | |
|
294 | 303 | var t = Environment.TickCount; |
|
295 | 304 | var res = args |
|
296 | 305 | .ChainedMap( |
|
306 | // Analysis disable once AccessToDisposedClosure | |
|
297 | 307 | x => pool.Invoke( |
|
298 | 308 | () => Math.Sin(x * x) |
|
299 | 309 | ), |
|
300 | 310 | 4 |
|
301 | 311 | ) |
|
302 | 312 | .Join(); |
|
303 | 313 | |
|
304 | 314 | Console.WriteLine("Map complete in {0} ms", Environment.TickCount - t); |
|
305 | 315 | |
|
306 | 316 | t = Environment.TickCount; |
|
307 | 317 | for (int i = 0; i < count; i++) |
|
308 | 318 | Assert.AreEqual(Math.Sin(args[i] * args[i]), res[i]); |
|
309 | 319 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
310 | 320 | Console.WriteLine("Max workers: {0}", pool.MaxRunningThreads); |
|
311 | 321 | } |
|
312 | 322 | } |
|
313 | 323 | |
|
314 | 324 | [TestMethod] |
|
315 | 325 | public void ParallelForEachTest() { |
|
316 | 326 | |
|
317 | int count = 100000; | |
|
327 | const int count = 100000; | |
|
318 | 328 | |
|
319 |
|
|
|
329 | var args = new int[count]; | |
|
320 | 330 | var rand = new Random(); |
|
321 | 331 | |
|
322 | 332 | for (int i = 0; i < count; i++) |
|
323 | 333 | args[i] = (int)(rand.NextDouble() * 100); |
|
324 | 334 | |
|
325 | 335 | int result = 0; |
|
326 | 336 | |
|
327 | 337 | var t = Environment.TickCount; |
|
328 | 338 | args.ParallelForEach(x => Interlocked.Add(ref result, x), 4).Join(); |
|
329 | 339 | |
|
330 | 340 | Console.WriteLine("Iteration complete in {0} ms, result: {1}", Environment.TickCount - t, result); |
|
331 | 341 | |
|
332 | 342 | int result2 = 0; |
|
333 | 343 | |
|
334 | 344 | t = Environment.TickCount; |
|
335 | 345 | for (int i = 0; i < count; i++) |
|
336 | 346 | result2 += args[i]; |
|
337 | 347 | Assert.AreEqual(result2, result); |
|
338 | 348 | Console.WriteLine("Verified in {0} ms", Environment.TickCount - t); |
|
339 | 349 | } |
|
340 | 350 | |
|
341 | 351 | [TestMethod] |
|
342 | 352 | public void ComplexCase1Test() { |
|
343 | 353 | var flags = new bool[3]; |
|
344 | 354 | |
|
345 | 355 | // op1 (aync 200ms) => op2 (async 200ms) => op3 (sync map) |
|
346 | 356 | |
|
347 | var p = PromiseHelper | |
|
357 | var step1 = PromiseHelper | |
|
348 | 358 | .Sleep(200, "Alan") |
|
349 | .Cancelled(() => flags[0] = true) | |
|
359 | .Cancelled(() => flags[0] = true); | |
|
360 | var p = step1 | |
|
350 | 361 | .Chain(x => |
|
351 | 362 | PromiseHelper |
|
352 | 363 | .Sleep(200, "Hi, " + x) |
|
353 | 364 | .Then(y => y) |
|
354 | 365 | .Cancelled(() => flags[1] = true) |
|
355 | 366 | ) |
|
356 | 367 | .Cancelled(() => flags[2] = true); |
|
357 |
|
|
|
368 | step1.Join(); | |
|
358 | 369 | p.Cancel(); |
|
359 | 370 | try { |
|
360 | 371 | Assert.AreEqual(p.Join(), "Hi, Alan"); |
|
361 | 372 | Assert.Fail("Shouldn't get here"); |
|
362 | 373 | } catch (OperationCanceledException) { |
|
363 | 374 | } |
|
364 | 375 | |
|
365 | 376 | Assert.IsFalse(flags[0]); |
|
366 | 377 | Assert.IsTrue(flags[1]); |
|
367 | 378 | Assert.IsTrue(flags[2]); |
|
368 | 379 | } |
|
369 | 380 | |
|
370 | 381 | [TestMethod] |
|
371 | 382 | public void ChainedCancel1Test() { |
|
372 | // при отмене сцепленной асинхронной операции все обещание должно | |
|
373 | // завершаться ошибкой OperationCanceledException | |
|
383 | // при отмене сцепленной асинхронной операции все обещание должно | |
|
384 | // завершаться ошибкой OperationCanceledException | |
|
374 | 385 | var p = PromiseHelper |
|
375 | 386 | .Sleep(1, "Hi, HAL!") |
|
376 | 387 | .Then(x => { |
|
377 | // запускаем две асинхронные операции | |
|
388 | // запускаем две асинхронные операции | |
|
378 | 389 | var result = PromiseHelper.Sleep(1000, "HEM ENABLED!!!"); |
|
379 | // вторая операция отменяет первую до завершения | |
|
390 | // вторая операция отменяет первую до завершения | |
|
380 | 391 | PromiseHelper |
|
381 | 392 | .Sleep(100, "HAL, STOP!") |
|
382 |
.Then( |
|
|
393 | .Then(result.Cancel); | |
|
383 | 394 | return result; |
|
384 | 395 | }); |
|
385 | 396 | try { |
|
386 | 397 | p.Join(); |
|
387 | 398 | } catch (TargetInvocationException err) { |
|
388 | 399 | Assert.IsTrue(err.InnerException is OperationCanceledException); |
|
389 | 400 | } |
|
390 | 401 | } |
|
391 | 402 | |
|
392 | 403 | [TestMethod] |
|
393 | 404 | public void ChainedCancel2Test() { |
|
394 | // при отмене цепочки обещаний, вложенные операции также должны отменяться | |
|
405 | // при отмене цепочки обещаний, вложенные операции также должны отменяться | |
|
395 | 406 | var pSurvive = new Promise<bool>(); |
|
396 | 407 | var hemStarted = new ManualResetEvent(false); |
|
397 | 408 | var p = PromiseHelper |
|
398 | 409 | .Sleep(1, "Hi, HAL!") |
|
399 | 410 | .Chain(x => { |
|
400 | 411 | hemStarted.Set(); |
|
401 | // запускаем две асинхронные операции | |
|
412 | // запускаем две асинхронные операции | |
|
402 | 413 | var result = PromiseHelper |
|
403 | 414 | .Sleep(10000, "HEM ENABLED!!!") |
|
404 | 415 | .Then(s => pSurvive.Resolve(false)); |
|
405 | 416 | |
|
406 | 417 | result |
|
407 | 418 | .Cancelled(() => pSurvive.Resolve(true)); |
|
408 | 419 | |
|
409 | 420 | return result; |
|
410 | 421 | }); |
|
411 | 422 | |
|
412 | 423 | hemStarted.WaitOne(); |
|
413 | 424 | p.Cancel(); |
|
414 | 425 | |
|
415 | 426 | try { |
|
416 | 427 | p.Join(); |
|
417 | 428 | } catch (OperationCanceledException) { |
|
418 | 429 | Assert.IsTrue(pSurvive.Join()); |
|
419 | 430 | } |
|
420 | 431 | } |
|
421 | 432 | } |
|
422 | 433 | } |
|
423 | 434 |
@@ -1,17 +1,13 | |||
|
1 | 1 | using Implab.Parallels; |
|
2 | using System; | |
|
3 | using System.Collections.Generic; | |
|
4 | using System.Linq; | |
|
5 | using System.Text; | |
|
6 | 2 | using System.Threading; |
|
7 | 3 | |
|
8 | 4 | namespace Implab.Test { |
|
9 | class PromiseHelper { | |
|
5 | static class PromiseHelper { | |
|
10 | 6 | public static IPromise<T> Sleep<T>(int timeout, T retVal) { |
|
11 | 7 | return AsyncPool.Invoke(() => { |
|
12 | 8 | Thread.Sleep(timeout); |
|
13 | 9 | return retVal; |
|
14 | 10 | }); |
|
15 | 11 | } |
|
16 | 12 | } |
|
17 | 13 | } |
@@ -1,35 +1,34 | |||
|
1 | 1 | using System.Reflection; |
|
2 | 2 | using System.Runtime.CompilerServices; |
|
3 | 3 | using System.Runtime.InteropServices; |
|
4 | 4 | |
|
5 | 5 | // General Information about an assembly is controlled through the following |
|
6 | 6 | // set of attributes. Change these attribute values to modify the information |
|
7 | 7 | // associated with an assembly. |
|
8 | 8 | [assembly: AssemblyTitle("Implab.Test")] |
|
9 | 9 | [assembly: AssemblyDescription("")] |
|
10 | 10 | [assembly: AssemblyConfiguration("")] |
|
11 | 11 | [assembly: AssemblyCompany("")] |
|
12 | 12 | [assembly: AssemblyProduct("Implab.Test")] |
|
13 | 13 | [assembly: AssemblyCopyright("Copyright © 2013")] |
|
14 | 14 | [assembly: AssemblyTrademark("")] |
|
15 | 15 | [assembly: AssemblyCulture("")] |
|
16 | 16 | |
|
17 | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
|
18 | 18 | // to COM components. If you need to access a type in this assembly from |
|
19 | 19 | // COM, set the ComVisible attribute to true on that type. |
|
20 | 20 | [assembly: ComVisible(false)] |
|
21 | 21 | |
|
22 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
|
23 | 23 | [assembly: Guid("bfcae720-21eb-4411-b70a-6eeab99071de")] |
|
24 | 24 | |
|
25 | 25 | // Version information for an assembly consists of the following four values: |
|
26 | 26 | // |
|
27 | 27 | // Major Version |
|
28 | 28 | // Minor Version |
|
29 | 29 | // Build Number |
|
30 | 30 | // Revision |
|
31 | 31 | // |
|
32 | 32 | // You can specify all the values or you can default the Build and Revision Numbers |
|
33 | 33 | // by using the '*' as shown below: |
|
34 |
[assembly: AssemblyVersion(" |
|
|
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | |
|
34 | [assembly: AssemblyVersion("0.0.*")] |
General Comments 0
You need to be logged in to leave comments.
Login now