Merge dev -> default

This commit is contained in:
Renaud Paquay
2010-04-13 11:32:26 -07:00
211 changed files with 20961 additions and 11155 deletions

View File

@@ -11,6 +11,9 @@
<CompileFolder>$(BuildFolder)\Compile</CompileFolder>
<WebSitesFolder>$(CompileFolder)\_PublishedWebsites</WebSitesFolder>
<StageFolder>$(BuildFolder)\Stage</StageFolder>
<BuildPlatform Condition="$(ProgramW6432) != ''">x64</BuildPlatform>
<BuildPlatform Condition="$(BuildPlatform) == ''">x86</BuildPlatform>
</PropertyGroup>
<Import Project="$(LibFolder)\msbuild\MSBuild.Community.Tasks.Targets"/>
@@ -48,9 +51,35 @@
<!-- Testing -->
<Target Name ="Test">
<Exec Command="$(LibFolder)\nunit\nunit-console-x86.exe /xml=$(BuildFolder)\Orchard.Tests.xml $(CompileFolder)\Orchard.Core.Tests.dll $(CompileFolder)\Orchard.Tests.dll $(CompileFolder)\Orchard.Tests.Modules.dll $(CompileFolder)\Orchard.Web.Tests.dll $(CompileFolder)\MSBuild.Orchard.Tasks.Tests.dll" />
<PropertyGroup>
<UseSqlite64 Condition="'$(teamcity_version)'=='' And '$(BuildPlatform)' == 'x64'">True</UseSqlite64>
</PropertyGroup>
<Message Condition="'$(UseSqlite64)' == 'True'" Text="Testing with x64 version of Sqlite"/>
<CreateItem Include="$(CompileFolder)\*.Tests.*dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<!-- use x64 sqlite for tests depending on build platform -->
<Copy Condition="'$(UseSqlite64)' == 'True'"
SourceFiles="$(LibFolder)\sqlite\x64\System.Data.SQLite.dll"
DestinationFiles="$(CompileFolder)\System.Data.SQLite.dll" />
<NUnit Assemblies="@(TestAssemblies)" ToolPath="$(LibFolder)\nunit" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Tests.xml" />
<!-- restore sqlite version if needed -->
<Copy Condition="'$(UseSqlite64)' == 'True'"
SourceFiles="$(LibFolder)\sqlite\System.Data.SQLite.dll"
DestinationFiles="$(CompileFolder)\System.Data.SQLite.dll" />
</Target>
<Target Name ="Spec">
<CreateItem Include="$(CompileFolder)\*.Specs.dll">
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
</CreateItem>
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="$(LibFolder)\nunit" />
</Target>
<!-- Packaging -->

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
Copyright 2004-2005 Castle Project - http://www.castleproject.org/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,27 @@
Autofac IoC Container
Copyright (c) 2007-2008 Autofac Contributors
http://code.google.com/p/autofac/wiki/Contributing
Other software included in this distribution is owned and
licensed separately, see the included license files for details.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -1,23 +0,0 @@
Open Source Initiative OSI - The MIT License:Licensing
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="TechTalk.SpecFlow.tasks"/>
<!-- this setting is to workaround the bug in VS (does not detect changes during the pre-build event)
see: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=423670&wa=wsignin1.0
-->
<PropertyGroup>
<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
</PropertyGroup>
<PropertyGroup>
<ShowTrace Condition="'$(ShowTrace)'==''">false</ShowTrace>
<OverwriteReadOnlyFiles Condition="'$(OverwriteReadOnlyFiles)'==''">false</OverwriteReadOnlyFiles>
<ForceGeneration Condition="'$(ForceGeneration)'==''">false</ForceGeneration>
<VerboseOutput Condition="'$(VerboseOutput)'==''">false</VerboseOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildServerMode)' == ''">
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'=='true'">false</BuildServerMode>
<BuildServerMode Condition="'$(BuildingInsideVisualStudio)'!='true'">true</BuildServerMode>
</PropertyGroup>
<PropertyGroup>
<BuildDependsOn>
UpdateFeatureFilesInProject;
$(BuildDependsOn)
</BuildDependsOn>
<RebuildDependsOn>
SwitchToForceGenerate;
$(RebuildDependsOn)
</RebuildDependsOn>
</PropertyGroup>
<Target Name="SwitchToForceGenerate">
<PropertyGroup>
<ForceGeneration>true</ForceGeneration>
<OnlyUpdateIfChanged>true</OnlyUpdateIfChanged>
</PropertyGroup>
</Target>
<Target Name="UpdateFeatureFilesInProject">
<GenerateAll
ShowTrace="$(ShowTrace)"
BuildServerMode="$(BuildServerMode)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
ProjectPath="$(MSBuildProjectFullPath)"
ForceGeneration="$(ForceGeneration)"
VerboseOutput="$(VerboseOutput)"
/>
</Target>
</Project>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SpecFlowTasksPath Condition="'$(SpecFlowTasksPath)'==''">specflow.exe</SpecFlowTasksPath>
</PropertyGroup>
<PropertyGroup>
<!-- handle absolute / targets-relative tasks path -->
<__SpecFlowTasksFullPath>$(SpecFlowTasksPath)</__SpecFlowTasksFullPath>
<!-- handle relative tasks path -->
<__SpecFlowTasksFullPath Condition="Exists('$(MSBuildProjectDirectory)\$(SpecFlowTasksPath)')"
>$(MSBuildProjectDirectory)\$(SpecFlowTasksPath)</__SpecFlowTasksFullPath>
</PropertyGroup>
<UsingTask TaskName="TechTalk.SpecFlow.Tools.MsBuild.GenerateAll" AssemblyFile="$(__SpecFlowTasksFullPath)" />
</Project>

View File

@@ -0,0 +1,50 @@
1.2.0 - 2009/11/25
New features:
+ Generate #line pragmas to the output file (Issue 26)
+ Allow transformation of feature files from command-line and MsBuild (Issue 3)
+ Merge all command-line tool (generation, reports) to a single executable: specflow.exe
+ Support for Dutch and Swedish language
+ Support enumerations in step binding arguments (Issue 28)
Fixed issues:
+ MsTest does not refresh tests automatically (Issue 25)
+ Fixes in report localization
+ Non-string parameters for bindings are not converted using the feature language (Issue 26)
1.1.0 - 2009/11/11
New features:
+ Support for MsTest (Issue 4)
+ Finalize configuration (Issue 13)
+ Support German, French and Hungarian languages (Issue 5)
+ Add strong-name for specflow assemblies (Issue 2)
+ Allow scenario events to be instance methods (Issue 20)
+ More descriptive name for the scenario outline example tests than XYZ_Variant1 (Issue 18)
+ NUnit SpecFlow test execution report (Issue 23)
+ Step definition usage report (Issue 24)
Fixed issues:
+ Runtime: Remove direct dependency on nunit.framework.dll from the runtime (Issue 12)
+ Runtime: Binding methods with more than 4 parameters cannot be used (Issue 21)
+ Generator: Special language characters (e.g. accented letters) are removed when generating test method names (Issue 22)
1.0.2 - 2009/10/20
New features:
+ Runtime: allow non-static bindings
+ Runtime: support multiple step attributes on a single binding method
Fixed issues:
+ VS: Error message is displayed when you add a SpecFlow project item to your project.
+ Parser: mixed order of Given/When/Then is not supported
+ Runtime: the original phrasing of the keywords (Given/And/But) is not preserved
+ Generator: the generated test class has a "Fixture" suffix
+ Parser: specifying any "given" should be optional
1.0.1 - 2009/10/13
Initial publish on http://www.specflow.org

BIN
lib/specflow/specflow.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/sqlite/x64/test.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,8 @@
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite"/>
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>

47
lib/yaml/ChangeLog.txt Normal file
View File

@@ -0,0 +1,47 @@
--- 2009-10-04 Osamu TAKEUCHI <osamu@big.jp>
Alpha release of YamlSerializer as 0.9.0.2
* All "_"s in integer and floating point values are neglected
to accommodate the !!int and !!float encoding.
* YamlConfig.DontUseVerbatimTag is added but the default value is set false.
Note that !<!System.Int32[,]> is much human friendly than !System.Int32%5B%2C%5D.
* Equality of YamlNode with an unknown tag is evaluated by identity,
while that of !!map and !!seq node is still evaluated by YAML's standard.
Note that equality of !!map and !!seq are different from that of object[]
and Dictionary<object, object>.
* YamlConfig.OmitTagForRootNode was added. Fixed issue #2850.
* Serialize Dictionary<object,object> to !!map. Fixed #2891.
* Modified [126-130] ns-plain-???, [147] c-ns-flow-map-separate-value(n,c)
to accommodate revision 2009-10-01
* Omit !< > if Tag contains only ns-tag-char, Fixed issue #2813
--- 2009-09-23 Osamu TAKEUCHI <osamu@big.jp>
Alpha release of YamlSerializer as 0.9.0.1
* Removed TODO's for reporting bugs in YAML spec that are done.
* Fixed assembly copyright.
* !!merge is supported. Fixed issue#2605.
* Read-only class-type member with no child members are omitted when
serializing. Fixed issue#2599.
* Culture for TypeConverter is set to be CultureInfo.InvariantCulture.
Fixed issue #2629.
* To fix Issue#2631
* Field names and property names are always presented as simple texts.
* When deserializing, we can not avoid the parser parses some spacial
names to !!bool and !!null. Such non-text nodes are converted to
texts at construction stage.
* To fix issue#2663
* Hash code stored in a mapping node is now updated when the a key node's
content is changed.
* Hash code and equality became independent on the order of keys in a
mapping node.
* A mapping node checks for duplicated keys every time the node content
is changed.
* Test results are changed because some of them are dependent on the hash
key order.
* The current equality evaluation is too strict, probably needs some adjustment.
* NativeObject property was added to YamlScalar.
* YamlScalar's equality is evaluated by comparing NativeObject.
--- 2009-09-11 Osamu TAKEUCHI <osamu@big.jp>
First release of YamlSerializer as 0.9.0.0

39
lib/yaml/Readme.txt Normal file
View File

@@ -0,0 +1,39 @@
YamlSerializer 0.9.0.2 (2009-10-04) Osamu TAKEUCHI <osamu@big.jp>
Description:
A library that serialize / deserialize C# native objects into YAML1.2 text.
Development environment:
Visual C# 2008 Express Edition
Sandcastle (2008-05-29)
SandcastleBuilder 1.8.0.2
HTML Help workshop 4.74.8702
NUnit 2.5.0.9122
TestDriven.NET 2.0
Support web page:
http://yamlserializer.codeplex.com/
License:
YamlSerializer is distributed under the MIT license as following:
---
The MIT License (MIT)
Copyright (c) 2009 Osamu TAKEUCHI <osamu@big.jp>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Binary file not shown.

3770
lib/yaml/YamlSerializer.XML Normal file

File diff suppressed because it is too large Load Diff

BIN
lib/yaml/YamlSerializer.dll Normal file

Binary file not shown.

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac.Builder;
using Autofac;
using JetBrains.Annotations;
using Moq;
using NUnit.Framework;
@@ -22,16 +22,16 @@ namespace Orchard.Core.Tests.Common.Providers {
private Mock<IMembershipService> _membership;
public override void Register(ContainerBuilder builder) {
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<TestHandler>().As<IContentHandler>();
builder.Register<CommonAspectHandler>().As<IContentHandler>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<TestHandler>().As<IContentHandler>();
builder.RegisterType<CommonAspectHandler>().As<IContentHandler>();
_authn = new Mock<IAuthenticationService>();
_authz = new Mock<IAuthorizationService>();
_membership = new Mock<IMembershipService>();
builder.Register(_authn.Object);
builder.Register(_authz.Object);
builder.Register(_membership.Object);
builder.RegisterInstance(_authn.Object);
builder.RegisterInstance(_authz.Object);
builder.RegisterInstance(_membership.Object);
}

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Autofac.Builder;
using Autofac;
using JetBrains.Annotations;
using NUnit.Framework;
using Orchard.ContentManagement;
@@ -21,9 +21,9 @@ namespace Orchard.Core.Tests.Common.Services {
}
public override void Register(ContainerBuilder builder) {
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<ThingHandler>().As<IContentHandler>();
builder.Register<RoutableService>().As<IRoutableService>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<ThingHandler>().As<IContentHandler>();
builder.RegisterType<RoutableService>().As<IRoutableService>();
}
private IRoutableService _routableService;

View File

@@ -4,8 +4,7 @@ using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using System.Xml.Linq;
using Autofac.Builder;
using Autofac.Modules;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.ContentManagement;
@@ -92,10 +91,10 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
var query = new StubQuery(Enumerable.Empty<ContentItem>());
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<FeedController>();
builder.Register<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.Register(query).As<IFeedQueryProvider>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<FeedController>();
builder.RegisterType<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.RegisterInstance(query).As<IFeedQueryProvider>();
var container = builder.Build();
var controller = container.Resolve<FeedController>();
@@ -118,10 +117,10 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
});
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<FeedController>();
builder.Register<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.Register(query).As<IFeedQueryProvider>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<FeedController>();
builder.RegisterType<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.RegisterInstance(query).As<IFeedQueryProvider>();
var container = builder.Build();
var controller = container.Resolve<FeedController>();
@@ -162,13 +161,13 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
.Returns(new ContentItemMetadata { DisplayText = "foo" });
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<FeedController>();
builder.Register(new RouteCollection());
builder.Register(mockContentManager.Object).As<IContentManager>();
builder.Register<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.Register<CorePartsFeedItemBuilder>().As<IFeedItemBuilder>();
builder.Register(query).As<IFeedQueryProvider>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<FeedController>();
builder.RegisterInstance(new RouteCollection());
builder.RegisterInstance(mockContentManager.Object).As<IContentManager>();
builder.RegisterType<RssFeedBuilder>().As<IFeedBuilderProvider>();
builder.RegisterType<CorePartsFeedItemBuilder>().As<IFeedItemBuilder>();
builder.RegisterInstance(query).As<IFeedQueryProvider>();
var container = builder.Build();
var controller = container.Resolve<FeedController>();

View File

@@ -31,7 +31,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=1.4.4.561, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
</Reference>
@@ -85,17 +85,17 @@
<Project>{6CB3EB30-F725-45C0-9742-42599BA8E8D2}</Project>
<Name>Orchard.Tests.Modules</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Tests\Orchard.Tests.csproj">
<ProjectReference Include="..\Orchard.Tests\Orchard.Framework.Tests.csproj">
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
<Name>Orchard.Tests</Name>
<Name>Orchard.Framework.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Web\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard\Orchard.csproj">
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard</Name>
<Name>Orchard.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Autofac.Builder;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.ContentManagement;
@@ -26,10 +26,10 @@ namespace Orchard.Core.Tests.Scheduling {
}
public override void Register(ContainerBuilder builder) {
_handler = new StubTaskHandler();
builder.Register(new Mock<IOrchardServices>().Object);
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<ScheduledTaskExecutor>().As<IBackgroundTask>().Named("ScheduledTaskExecutor");
builder.Register(_handler).As<IScheduledTaskHandler>();
builder.RegisterInstance(new Mock<IOrchardServices>().Object);
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<ScheduledTaskExecutor>().As<IBackgroundTask>().Named("ScheduledTaskExecutor", typeof (IBackgroundTask));
builder.RegisterInstance(_handler).As<IScheduledTaskHandler>();
}
protected override IEnumerable<Type> DatabaseTypes {

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac.Builder;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.ContentManagement;
@@ -30,9 +30,9 @@ namespace Orchard.Core.Tests.Scheduling {
}
public override void Register(ContainerBuilder builder) {
builder.Register(_mockServices.Object);
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<ScheduledTaskManager>().As<IScheduledTaskManager>();
builder.RegisterInstance(_mockServices.Object);
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
}
protected override IEnumerable<Type> DatabaseTypes {

View File

@@ -0,0 +1,40 @@
using NUnit.Framework;
using TechTalk.SpecFlow;
namespace Orchard.Specs.Bindings {
[Binding]
public class SanityCheck {
private bool _runSteps;
private bool _valueSet;
private int _value;
[Given("I have a scenario")]
public void GivenIHaveAScenario() {
}
[When("I run steps")]
public void WhenIRunSteps() {
_runSteps = true;
}
[When(@"they have values like ""(.*)""")]
public void WhenTheyHaveValuesLike(int value) {
Assert.That(_valueSet, Is.False);
_value = value;
_valueSet = true;
}
[Then("they run")]
public void ThenTheyRun() {
Assert.That(_runSteps, Is.True);
}
[Then("values like five are captured")]
public void ThenValuesLikeFiveAreCaptured() {
Assert.That(_valueSet, Is.True);
Assert.That(_value, Is.EqualTo(5));
}
}
}

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7354DF37-934B-46CF-A13C-455D5F5F5413}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Specs</RootNamespace>
<AssemblyName>Orchard.Specs</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="TechTalk.SpecFlow, Version=1.2.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\specflow\TechTalk.SpecFlow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UsingSpecFlow.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>UsingSpecFlow.feature</DependentUpon>
</Compile>
<Compile Include="Bindings\SanityCheck.cs" />
</ItemGroup>
<ItemGroup>
<None Include="UsingSpecFlow.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>UsingSpecFlow.feature.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Orchard.Specs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Orchard.Specs")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c33d89c4-824c-4859-bd89-695aa1efd17b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,11 @@
Feature: Using SpecFlow
In order to test Orchard
As a developer or contributor
I want to define scenarios that ensure functionality
Scenario: Spec flow generates and runs via nunit
Given I have a scenario
When I run steps
And they have values like "5"
Then they run
And values like five are captured

View File

@@ -0,0 +1,74 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.2.0.0
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Using SpecFlow")]
public partial class UsingSpecFlowFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "UsingSpecFlow.feature"
#line hidden
[NUnit.Framework.TestFixtureSetUpAttribute()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Using SpecFlow", "In order to test Orchard\r\nAs a developer or contributor\r\nI want to define scenari" +
"os that ensure functionality", ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Spec flow generates and runs via nunit")]
public virtual void SpecFlowGeneratesAndRunsViaNunit()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Spec flow generates and runs via nunit", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
testRunner.Given("I have a scenario");
#line 8
testRunner.When("I run steps");
#line 9
testRunner.And("they have values like \"5\"");
#line 10
testRunner.Then("they run");
#line 11
testRunner.And("values like five are captured");
#line hidden
testRunner.CollectScenarioErrors();
}
}
}

View File

@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using NHibernate;
using NUnit.Framework;
using Orchard.Data;
@@ -40,9 +38,9 @@ namespace Orchard.Tests.Modules {
_clock = new StubClock();
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register(new StubLocator(_session)).As<ISessionLocator>();
builder.Register(_clock).As<IClock>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterInstance(new StubLocator(_session)).As<ISessionLocator>();
builder.RegisterInstance(_clock).As<IClock>();
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
Register(builder);
_container = builder.Build();

View File

@@ -31,7 +31,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=1.4.4.561, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
</Reference>
@@ -95,9 +95,9 @@
<Compile Include="XmlRpc\Services\XmlRpcWriterTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard.Tests\Orchard.Tests.csproj">
<ProjectReference Include="..\Orchard.Tests\Orchard.Framework.Tests.csproj">
<Project>{ABC826D4-2FA1-4F2F-87DE-E6095F653810}</Project>
<Name>Orchard.Tests</Name>
<Name>Orchard.Framework.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Web\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
@@ -119,9 +119,9 @@
<Project>{79AED36E-ABD0-4747-93D3-8722B042454B}</Project>
<Name>Orchard.Users</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard\Orchard.csproj">
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard</Name>
<Name>Orchard.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac.Builder;
using Autofac;
using NUnit.Framework;
using Orchard.Roles.Models;
using Orchard.Roles.Services;
@@ -10,7 +10,7 @@ namespace Orchard.Tests.Modules.Roles.Services {
[TestFixture]
public class RoleServiceTests : DatabaseEnabledTestsBase{
public override void Register(ContainerBuilder builder) {
builder.Register<RoleService>().As<IRoleService>();
builder.RegisterType<RoleService>().As<IRoleService>();
}
protected override IEnumerable<Type> DatabaseTypes {

View File

@@ -3,12 +3,9 @@ using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
using Autofac.Builder;
using JetBrains.Annotations;
using Moq;
using NUnit.Framework;
using Orchard.Data.Builders;
using Orchard.Environment;
using Orchard.Environment.AutofacUtil;
using Orchard.Environment.Configuration;
using Orchard.Setup.Controllers;
using Orchard.Setup.ViewModels;
@@ -18,7 +15,7 @@ namespace Orchard.Tests.Modules.Setup {
[TestFixture, Ignore("this can't be made to work")]
public class SetupControllerTests {
private string _tempFolder;
private IContainer _container;
private ILifetimeScope _container;
[SetUp]
public void Init() {
@@ -27,27 +24,26 @@ namespace Orchard.Tests.Modules.Setup {
Directory.CreateDirectory(_tempFolder);
var hostContainer = OrchardStarter.CreateHostContainer(builder => {
builder.Register(new ControllerBuilder());
builder.Register(new ViewEngineCollection { new WebFormViewEngine() });
builder.Register(new RouteCollection());
builder.Register(new ModelBinderDictionary());
builder.RegisterInstance(new ControllerBuilder());
builder.RegisterInstance(new ViewEngineCollection { new WebFormViewEngine() });
builder.RegisterInstance(new RouteCollection());
builder.RegisterInstance(new ModelBinderDictionary());
});
hostContainer.Resolve<IAppDataFolder>().SetBasePath(_tempFolder);
var host = (DefaultOrchardHost)hostContainer.Resolve<IOrchardHost>();
_container = host.CreateShellContainer();
_container.Build(builder => {
builder.Register<SetupController>();
});
_container = host.CreateShellContainer().BeginLifetimeScope();
var updater = new ContainerUpdater();
updater.RegisterType<SetupController>();
updater.Update(_container);
//var builder = new ContainerBuilder();
//builder.Register<SetupController>();
//builder.Register<Notifier>().As<INotifier>();
//builder.Register<DefaultOrchardHost>().As<IOrchardHost>();
//builder.Register<DatabaseMigrationManager>().As<IDatabaseMigrationManager>();
//builder.Register<ShellSettingsLoader>().As<IShellSettingsLoader>();
//builder.Register<DefaultTenantManager>().As<ITenantManager>();
//builder.Register<TestAppDataFolder>().As<IAppDataFolder>();
//_container = builder.Build();
}

View File

@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac.Builder;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.Data;
@@ -30,17 +28,17 @@ namespace Orchard.Tests.Modules.Users.Controllers {
private Mock<IAuthorizer> _authorizer;
public override void Register(ContainerBuilder builder) {
builder.Register<AdminController>();
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<DefaultContentQuery>().As<IContentQuery>().FactoryScoped();
builder.Register<MembershipService>().As<IMembershipService>();
builder.Register<UserService>().As<IUserService>();
builder.Register<UserHandler>().As<IContentHandler>();
builder.Register<OrchardServices>().As<IOrchardServices>();
builder.Register<TransactionManager>().As<ITransactionManager>();
builder.Register(new Mock<INotifier>().Object);
builder.RegisterType<AdminController>().SingleInstance();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>().InstancePerDependency();
builder.RegisterType<MembershipService>().As<IMembershipService>();
builder.RegisterType<UserService>().As<IUserService>();
builder.RegisterType<UserHandler>().As<IContentHandler>();
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
builder.RegisterType<TransactionManager>().As<ITransactionManager>();
builder.RegisterInstance(new Mock<INotifier>().Object);
_authorizer = new Mock<IAuthorizer>();
builder.Register(_authorizer.Object);
builder.RegisterInstance(_authorizer.Object);
}
protected override IEnumerable<Type> DatabaseTypes {

View File

@@ -1,8 +1,6 @@
using System;
using System.Web.Security;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using NHibernate;
using NUnit.Framework;
using Orchard.Data;
@@ -54,13 +52,13 @@ namespace Orchard.Tests.Modules.Users.Services {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<MembershipService>().As<IMembershipService>();
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<UserHandler>().As<IContentHandler>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<MembershipService>().As<IMembershipService>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<UserHandler>().As<IContentHandler>();
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
_session = _sessionFactory.OpenSession();
builder.Register(new TestSessionLocator(_session)).As<ISessionLocator>();
builder.RegisterInstance(new TestSessionLocator(_session)).As<ISessionLocator>();
_container = builder.Build();
_membershipService = _container.Resolve<IMembershipService>();
}

View File

@@ -1,6 +1,5 @@
using System.Xml.Linq;
using Autofac.Builder;
using Autofac.Modules;
using Autofac;
using NUnit.Framework;
using Orchard.Core.XmlRpc;
using Orchard.Core.XmlRpc.Controllers;
@@ -16,12 +15,12 @@ namespace Orchard.Tests.Modules.XmlRpc.Controllers {
var thing2 = new StubHandler();
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule()); ;
builder.Register<HomeController>();
builder.Register<XmlRpcReader>().As<IMapper<XElement, XRpcMethodCall>>();
builder.Register<XmlRpcWriter>().As<IMapper<XRpcMethodResponse, XElement>>();
builder.Register(thing1).As<IXmlRpcHandler>();
builder.Register(thing2).As<IXmlRpcHandler>();
//builder.RegisterModule(new ImplicitCollectionSupportModule()); ;
builder.RegisterType<HomeController>();
builder.RegisterType<XmlRpcReader>().As<IMapper<XElement, XRpcMethodCall>>();
builder.RegisterType<XmlRpcWriter>().As<IMapper<XRpcMethodResponse, XElement>>();
builder.RegisterInstance(thing1).As<IXmlRpcHandler>();
builder.RegisterInstance(thing2).As<IXmlRpcHandler>();
var container = builder.Build();

View File

@@ -4,7 +4,7 @@
<sources>
<source name="Orchard.Tests.Logging.Thing" switchValue="Warning">
<listeners>
<add name="loopback" type="Orchard.Tests.Logging.InMemoryCapture,Orchard.Tests" />
<add name="loopback" type="Orchard.Tests.Logging.InMemoryCapture,Orchard.Framework.Tests" />
</listeners>
</source>
</sources>

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Orchard.Commands;
namespace Orchard.Tests.Commands {
[TestFixture]
public class CommandHandlerDescriptorBuilderTests {
[Test]
public void BuilderShouldCreateDescriptor() {
var builder = new CommandHandlerDescriptorBuilder();
var descriptor = builder.Build(typeof(MyCommand));
Assert.That(descriptor, Is.Not.Null);
Assert.That(descriptor.Commands.Count(), Is.EqualTo(4));
Assert.That(descriptor.Commands.Single(d => d.Name == "FooBar"), Is.Not.Null);
Assert.That(descriptor.Commands.Single(d => d.Name == "FooBar").MethodInfo, Is.EqualTo(typeof(MyCommand).GetMethod("FooBar")));
Assert.That(descriptor.Commands.Single(d => d.Name == "MyCommand"), Is.Not.Null);
Assert.That(descriptor.Commands.Single(d => d.Name == "MyCommand").MethodInfo, Is.EqualTo(typeof(MyCommand).GetMethod("FooBar2")));
Assert.That(descriptor.Commands.Single(d => d.Name == "Foo Bar"), Is.Not.Null);
Assert.That(descriptor.Commands.Single(d => d.Name == "Foo Bar").MethodInfo, Is.EqualTo(typeof(MyCommand).GetMethod("Foo_Bar")));
Assert.That(descriptor.Commands.Single(d => d.Name == "Foo_Bar"), Is.Not.Null);
Assert.That(descriptor.Commands.Single(d => d.Name == "Foo_Bar").MethodInfo, Is.EqualTo(typeof(MyCommand).GetMethod("Foo_Bar3")));
}
public class MyCommand : DefaultOrchardCommandHandler {
public void FooBar() {
}
[CommandName("MyCommand")]
public void FooBar2() {
}
public void Foo_Bar() {
}
[CommandName("Foo_Bar")]
public void Foo_Bar3() {
}
}
}
}

View File

@@ -0,0 +1,232 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using NUnit.Framework;
using Orchard.Commands;
using System;
using System.Linq;
namespace Orchard.Tests.Commands {
[TestFixture]
public class CommandsTests {
private ICommandHandler _handler;
[SetUp]
public void Init() {
_handler = new StubCommandHandler();
}
private CommandContext CreateCommandContext(string commandName) {
return CreateCommandContext(commandName, new Dictionary<string, string>(), new string[]{});
}
private CommandContext CreateCommandContext(string commandName, IDictionary<string, string> switches) {
return CreateCommandContext(commandName, switches, new string[]{});
}
private CommandContext CreateCommandContext(string commandName, IDictionary<string, string> switches, string[] args) {
var builder = new CommandHandlerDescriptorBuilder();
var descriptor = builder.Build(typeof(StubCommandHandler));
var commandDescriptor = descriptor.Commands.Single(d => string.Equals(d.Name, commandName, StringComparison.OrdinalIgnoreCase));
return new CommandContext {
Command = commandName,
Switches = switches,
CommandDescriptor = commandDescriptor,
Arguments = args,
Input = new StringReader(string.Empty),
Output = new StringWriter()
};
}
[Test]
public void TestFooCommand() {
var commandContext = CreateCommandContext("Foo");
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("Command Foo Executed"));
}
[Test]
public void TestNotExistingCommand() {
Assert.Throws<InvalidOperationException>(() => {
var commandContext = CreateCommandContext("NoSuchCommand");
_handler.Execute(commandContext);
});
}
[Test]
public void TestCommandWithCustomAlias() {
var commandContext = CreateCommandContext("Bar");
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("Hello World!"));
}
[Test]
public void TestHelpText() {
var commandContext = CreateCommandContext("Baz");
Assert.That(commandContext.CommandDescriptor.HelpText, Is.EqualTo("Baz help"));
}
[Test]
public void TestEmptyHelpText() {
var commandContext = CreateCommandContext("Foo");
Assert.That(commandContext.CommandDescriptor.HelpText, Is.EqualTo(string.Empty));
}
[Test]
public void TestBooleanSwitchForCommand() {
var commandContext = CreateCommandContext("Baz", new Dictionary<string, string> {{"Verbose", "true"}});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("Command Baz Called : This was a test"));
}
[Test]
public void TestIntSwitchForCommand() {
var commandContext = CreateCommandContext("Baz", new Dictionary<string, string> {{"Level", "2"}});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("Command Baz Called : Entering Level 2"));
}
[Test]
public void TestStringSwitchForCommand() {
var commandContext = CreateCommandContext("Baz", new Dictionary<string, string> {{"User", "OrchardUser"}});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("Command Baz Called : current user is OrchardUser"));
}
[Test]
public void TestSwitchForCommandWithoutSupportForIt() {
var switches = new Dictionary<string, string> {{"User", "OrchardUser"}};
var commandContext = CreateCommandContext("Foo", switches);
Assert.Throws<InvalidOperationException>(() => _handler.Execute(commandContext));
}
[Test]
public void TestCommandThatDoesNotReturnAValue() {
var commandContext = CreateCommandContext("Log");
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo(""));
}
[Test]
public void TestNotExistingSwitch() {
var switches = new Dictionary<string, string> {{"ThisSwitchDoesNotExist", "Insignificant"}};
var commandContext = CreateCommandContext("Foo", switches);
Assert.Throws<InvalidOperationException>(() => _handler.Execute(commandContext));
}
[Test]
public void TestCommandArgumentsArePassedCorrectly() {
var commandContext = CreateCommandContext("Concat", new Dictionary<string, string>(), new[] {"left to ", "right"});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("left to right"));
}
[Test]
public void TestCommandArgumentsArePassedCorrectlyWithAParamsParameters() {
var commandContext = CreateCommandContext("ConcatParams", new Dictionary<string, string>(), new[] {"left to ", "right"});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("left to right"));
}
[Test]
public void TestCommandArgumentsArePassedCorrectlyWithAParamsParameterAndNoArguments() {
var commandContext = CreateCommandContext("ConcatParams", new Dictionary<string, string>());
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo(""));
}
[Test]
public void TestCommandArgumentsArePassedCorrectlyWithNormalParametersAndAParamsParameters() {
var commandContext = CreateCommandContext("ConcatAllParams",
new Dictionary<string, string>(),
new[] { "left-", "center-", "right"});
_handler.Execute(commandContext);
Assert.That(commandContext.Output.ToString(), Is.EqualTo("left-center-right"));
}
[Test]
public void TestCommandParamsMismatchWithoutParamsNotEnoughArguments() {
var commandContext = CreateCommandContext("Concat", new Dictionary<string, string>(), new[] { "left to " });
Assert.Throws<InvalidOperationException>(() => _handler.Execute(commandContext));
}
[Test]
public void TestCommandParamsMismatchWithoutParamsTooManyArguments() {
var commandContext = CreateCommandContext("Foo", new Dictionary<string, string>(), new[] { "left to " });
Assert.Throws<InvalidOperationException>(() => _handler.Execute(commandContext));
}
[Test]
public void TestCommandParamsMismatchWithParamsButNotEnoughArguments() {
var commandContext = CreateCommandContext("ConcatAllParams", new Dictionary<string, string>());
Assert.Throws<InvalidOperationException>(() => _handler.Execute(commandContext));
}
}
public class StubCommandHandler : DefaultOrchardCommandHandler {
[OrchardSwitch]
public bool Verbose { get; set; }
[OrchardSwitch]
public int Level { get; set; }
[OrchardSwitch]
public string User { get; set; }
public string Foo() {
return "Command Foo Executed";
}
[CommandName("Bar")]
public string Hello() {
return "Hello World!";
}
[OrchardSwitches("Verbose, Level, User")]
[CommandHelp("Baz help")]
public string Baz() {
string trace = "Command Baz Called";
if (Verbose) {
trace += " : This was a test";
}
if (Level == 2) {
trace += " : Entering Level 2";
}
if (!String.IsNullOrEmpty(User)) {
trace += " : current user is " + User;
}
return trace;
}
public string Concat(string left, string right) {
return left + right;
}
public string ConcatParams(params string[] parameters) {
string concatenated = "";
foreach (var s in parameters) {
concatenated += s;
}
return concatenated;
}
public string ConcatAllParams(string leftmost, params string[] rest) {
string concatenated = leftmost;
foreach (var s in rest) {
concatenated += s;
}
return concatenated;
}
public void Log() {
return;
}
}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Autofac;
using NUnit.Framework;
using Orchard.Commands;
namespace Orchard.Tests.Commands {
[TestFixture]
public class CommandManagerTests {
private ICommandManager _manager;
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterType<DefaultCommandManager>().As<ICommandManager>();
builder.RegisterType<MyCommand>().As<ICommandHandler>();
builder.RegisterModule(new CommandModule());
var container = builder.Build();
_manager = container.Resolve<ICommandManager>();
}
[Test]
public void ManagerCanRunACommand() {
var context = new CommandParameters { Arguments = new string[] { "FooBar" }, Output = new StringWriter()};
_manager.Execute(context);
Assert.That(context.Output.ToString(), Is.EqualTo("success!"));
}
[Test]
public void ManagerCanRunACompositeCommand() {
var context = new CommandParameters { Arguments = ("Foo Bar Bleah").Split(' '), Output = new StringWriter() };
_manager.Execute(context);
Assert.That(context.Output.ToString(), Is.EqualTo("Bleah"));
}
public class MyCommand : DefaultOrchardCommandHandler {
public string FooBar() {
return "success!";
}
public string Foo_Bar(string bleah) {
return bleah;
}
}
}
}

View File

@@ -1,13 +1,12 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using Moq;
using NUnit.Framework;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Environment.AutofacUtil;
using Orchard.Mvc.ViewModels;
using Orchard.UI.Zones;
@@ -19,8 +18,8 @@ namespace Orchard.Tests.ContentManagement {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<ContentPartDriverHandler>().As<IContentHandler>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<ContentPartDriverHandler>().As<IContentHandler>();
_container = builder.Build();
}
@@ -34,10 +33,10 @@ namespace Orchard.Tests.ContentManagement {
public void AllDriversShouldBeCalled() {
var driver1 = new Mock<IContentPartDriver>();
var driver2 = new Mock<IContentPartDriver>();
_container.Build(x => {
x.Register(driver1.Object);
x.Register(driver2.Object);
});
var builder = new ContainerUpdater();
builder.RegisterInstance(driver1.Object);
builder.RegisterInstance(driver2.Object);
builder.Update(_container);
var contentHandler = _container.Resolve<IContentHandler>();
var ctx = new BuildDisplayModelContext(new ContentItemViewModel(new ContentItem()), null);
@@ -50,7 +49,9 @@ namespace Orchard.Tests.ContentManagement {
[Test]
public void TestDriverCanAddDisplay() {
var driver = new StubPartDriver();
_container.Build(x => x.Register(driver).As<IContentPartDriver>());
var builder = new ContainerUpdater();
builder.RegisterInstance(driver).As<IContentPartDriver>();
builder.Update(_container);
var contentHandler = _container.Resolve<IContentHandler>();

View File

@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using NHibernate;
using NUnit.Framework;
using Orchard.Data;
@@ -45,21 +40,21 @@ namespace Orchard.Tests.ContentManagement {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
// builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterModule(new ContentModule());
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<AlphaHandler>().As<IContentHandler>();
builder.Register<BetaHandler>().As<IContentHandler>();
builder.Register<GammaHandler>().As<IContentHandler>();
builder.Register<DeltaHandler>().As<IContentHandler>();
builder.Register<EpsilonHandler>().As<IContentHandler>();
builder.Register<FlavoredHandler>().As<IContentHandler>();
builder.Register<StyledHandler>().As<IContentHandler>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>().SingleInstance();
builder.RegisterType<AlphaHandler>().As<IContentHandler>();
builder.RegisterType<BetaHandler>().As<IContentHandler>();
builder.RegisterType<GammaHandler>().As<IContentHandler>();
builder.RegisterType<DeltaHandler>().As<IContentHandler>();
builder.RegisterType<EpsilonHandler>().As<IContentHandler>();
builder.RegisterType<FlavoredHandler>().As<IContentHandler>();
builder.RegisterType<StyledHandler>().As<IContentHandler>();
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
_session = _sessionFactory.OpenSession();
builder.Register(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
_session.Delete(string.Format("from {0}", typeof(GammaRecord).FullName));
_session.Delete(string.Format("from {0}", typeof(DeltaRecord).FullName));

View File

@@ -2,8 +2,6 @@
using System.Diagnostics;
using System.Linq;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using NHibernate;
using NUnit.Framework;
using Orchard.Data;
@@ -42,20 +40,20 @@ namespace Orchard.Tests.ContentManagement {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<DefaultContentManager>().As<IContentManager>();
builder.Register<AlphaHandler>().As<IContentHandler>();
builder.Register<BetaHandler>().As<IContentHandler>();
builder.Register<GammaHandler>().As<IContentHandler>();
builder.Register<DeltaHandler>().As<IContentHandler>();
builder.Register<EpsilonHandler>().As<IContentHandler>();
builder.Register<FlavoredHandler>().As<IContentHandler>();
builder.Register<StyledHandler>().As<IContentHandler>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<AlphaHandler>().As<IContentHandler>();
builder.RegisterType<BetaHandler>().As<IContentHandler>();
builder.RegisterType<GammaHandler>().As<IContentHandler>();
builder.RegisterType<DeltaHandler>().As<IContentHandler>();
builder.RegisterType<EpsilonHandler>().As<IContentHandler>();
builder.RegisterType<FlavoredHandler>().As<IContentHandler>();
builder.RegisterType<StyledHandler>().As<IContentHandler>();
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
_session = _sessionFactory.OpenSession();
builder.Register(new TestSessionLocator(_session)).As<ISessionLocator>();
builder.RegisterInstance(new TestSessionLocator(_session)).As<ISessionLocator>();
_container = builder.Build();
_manager = _container.Resolve<IContentManager>();

View File

@@ -0,0 +1,141 @@
using System;
using Autofac;
using Autofac.Core;
using Autofac.Features.Metadata;
using Castle.Core.Interceptor;
using NUnit.Framework;
using Orchard.Environment.AutofacUtil.DynamicProxy2;
namespace Orchard.Tests.Environment.AutofacUtil.DynamicProxy2 {
[TestFixture]
public class DynamicProxyTests {
[Test]
public void ContextAddedToMetadataWhenRegistered() {
var context = new DynamicProxyContext();
var builder = new ContainerBuilder();
builder.RegisterType<SimpleComponent>().EnableDynamicProxy(context);
var container = builder.Build();
var meta = container.Resolve<Meta<SimpleComponent>>();
Assert.That(meta.Metadata, Has.Some.Property("Key").EqualTo("Orchard.Environment.AutofacUtil.DynamicProxy2.DynamicProxyContext.ProxyContextKey"));
Assert.That(meta.Metadata["Orchard.Environment.AutofacUtil.DynamicProxy2.DynamicProxyContext.ProxyContextKey"], Is.SameAs(context));
}
[Test]
public void ProxyContextReturnsTrueIfTypeHasBeenProxied() {
var context = new DynamicProxyContext();
Type proxyType;
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
Assert.That(proxyType, Is.Null);
context.AddProxy(typeof(SimpleComponent));
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
Assert.That(proxyType, Is.Not.Null);
}
[Test]
public void AddProxyCanBeCalledMoreThanOnce() {
var context = new DynamicProxyContext();
context.AddProxy(typeof(SimpleComponent));
Type proxyType;
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
Assert.That(proxyType, Is.Not.Null);
Type proxyType2;
context.AddProxy(typeof(SimpleComponent));
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType2), Is.True);
Assert.That(proxyType2, Is.SameAs(proxyType));
}
[Test]
public void InterceptorAddedToContextFromModules() {
var context = new DynamicProxyContext();
var builder = new ContainerBuilder();
builder.RegisterType<SimpleComponent>().EnableDynamicProxy(context);
builder.RegisterModule(new SimpleInterceptorModule());
builder.Build();
Type proxyType;
Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
Assert.That(proxyType, Is.Not.Null);
}
[Test]
public void ResolvedObjectIsSubclass() {
var context = new DynamicProxyContext();
var builder = new ContainerBuilder();
builder.RegisterType<SimpleComponent>().EnableDynamicProxy(context);
builder.RegisterModule(new SimpleInterceptorModule());
var container = builder.Build();
var simpleComponent = container.Resolve<SimpleComponent>();
Assert.That(simpleComponent, Is.InstanceOf<SimpleComponent>());
Assert.That(simpleComponent, Is.Not.TypeOf<SimpleComponent>());
}
[Test]
public void InterceptorCatchesMethodCallOnlyFromContainerWithInterceptor() {
var context = new DynamicProxyContext();
var builder1 = new ContainerBuilder();
builder1.RegisterType<SimpleComponent>().EnableDynamicProxy(context);
builder1.RegisterModule(new SimpleInterceptorModule());
var container1 = builder1.Build();
var simple1 = container1.Resolve<SimpleComponent>();
var builder2 = new ContainerBuilder();
builder2.RegisterType<SimpleComponent>().EnableDynamicProxy(context);
var container2 = builder2.Build();
var simple2 = container2.Resolve<SimpleComponent>();
Assert.That(simple2.SimpleMethod(), Is.EqualTo("default return value"));
Assert.That(simple1.SimpleMethod(), Is.EqualTo("different return value"));
}
}
public class SimpleComponent {
public virtual string SimpleMethod() {
return "default return value";
}
}
public class SimpleInterceptorModule : Module {
protected override void Load(ContainerBuilder builder) {
builder.RegisterType<SimpleInterceptor>();
base.Load(builder);
}
protected override void AttachToComponentRegistration(
IComponentRegistry componentRegistry,
IComponentRegistration registration) {
if (DynamicProxyContext.From(registration) != null)
registration.InterceptedBy<SimpleInterceptor>();
}
}
public class SimpleInterceptor : IInterceptor {
public void Intercept(IInvocation invocation) {
if (invocation.Method.Name == "SimpleMethod") {
invocation.ReturnValue = "different return value";
}
else {
invocation.Proceed();
}
}
}
}

View File

@@ -77,5 +77,19 @@ namespace Orchard.Tests.Environment.Configuration {
_appDataFolder.CreateFile("alpha\\omega\\foo\\bar.txt", "quux");
Assert.That(Directory.Exists(Path.Combine(_tempFolder, "alpha\\omega\\foo")), Is.True);
}
[Test]
public void FilesCanBeReadBack() {
_appDataFolder.CreateFile("alpha\\gamma\\foo\\bar.txt", @"
this is
a
test");
var text = _appDataFolder.ReadFile("alpha\\gamma\\foo\\bar.txt");
Assert.That(text, Is.EqualTo(@"
this is
a
test"));
}
}
}

View File

@@ -0,0 +1,76 @@
using System.IO;
using System.Linq;
using NUnit.Framework;
using Orchard.Environment.Configuration;
namespace Orchard.Tests.Environment.Configuration {
[TestFixture]
public class DefaultTenantManagerTests {
private string _tempFolder;
private AppDataFolder _appData;
[SetUp]
public void Init() {
_appData = new AppDataFolder();
_tempFolder = Path.GetTempFileName();
File.Delete(_tempFolder);
_appData.SetBasePath(_tempFolder);
}
[TearDown]
public void Term() {
Directory.Delete(_tempFolder, true);
}
[Test]
public void SingleSettingsFileShouldComeBackAsExpected() {
_appData.CreateFile("Sites\\Default\\Settings.txt", "Name: Default\r\nDataProvider: SQLite\r\nDataConnectionString: something else");
ITenantManager loader = new DefaultTenantManager(_appData);
var settings = loader.LoadSettings().Single();
Assert.That(settings, Is.Not.Null);
Assert.That(settings.Name, Is.EqualTo("Default"));
Assert.That(settings.DataProvider, Is.EqualTo("SQLite"));
Assert.That(settings.DataConnectionString, Is.EqualTo("something else"));
}
[Test]
public void MultipleFilesCanBeDetected() {
_appData.CreateFile("Sites\\Default\\Settings.txt", "Name: Default\r\nDataProvider: SQLite\r\nDataConnectionString: something else");
_appData.CreateFile("Sites\\Another\\Settings.txt", "Name: Another\r\nDataProvider: SQLite2\r\nDataConnectionString: something else2");
ITenantManager loader = new DefaultTenantManager(_appData);
var settings = loader.LoadSettings();
Assert.That(settings.Count(), Is.EqualTo(2));
var def = settings.Single(x => x.Name == "Default");
Assert.That(def.Name, Is.EqualTo("Default"));
Assert.That(def.DataProvider, Is.EqualTo("SQLite"));
Assert.That(def.DataConnectionString, Is.EqualTo("something else"));
var alt = settings.Single(x => x.Name == "Another");
Assert.That(alt.Name, Is.EqualTo("Another"));
Assert.That(alt.DataProvider, Is.EqualTo("SQLite2"));
Assert.That(alt.DataConnectionString, Is.EqualTo("something else2"));
}
[Test]
public void NewSettingsCanBeStored() {
_appData.CreateFile("Sites\\Default\\Settings.txt", "Name: Default\r\nDataProvider: SQLite\r\nDataConnectionString: something else");
ITenantManager loader = new DefaultTenantManager(_appData);
var foo = new ShellSettings {Name = "Foo", DataProvider = "Bar", DataConnectionString = "Quux"};
Assert.That(loader.LoadSettings().Count(), Is.EqualTo(1));
loader.SaveSettings(foo);
Assert.That(loader.LoadSettings().Count(), Is.EqualTo(2));
var text = File.ReadAllText(_appData.MapPath("Sites\\Foo\\Settings.txt"));
Assert.That(text, Is.StringContaining("Foo"));
Assert.That(text, Is.StringContaining("Bar"));
Assert.That(text, Is.StringContaining("Quux"));
}
}
}

View File

@@ -6,10 +6,10 @@ using System.Web.Mvc;
using System.Web.Routing;
using Autofac;
using Autofac.Integration.Web;
using Autofac.Modules;
using Moq;
using NUnit.Framework;
using Orchard.Environment;
using Orchard.Environment.AutofacUtil;
using Orchard.Environment.Configuration;
using Orchard.Mvc;
using Orchard.Mvc.ModelBinders;
@@ -22,6 +22,7 @@ namespace Orchard.Tests.Environment {
[TestFixture]
public class DefaultOrchardHostTests {
private IContainer _container;
private ILifetimeScope _lifetime;
private RouteCollection _routeCollection;
private ModelBinderDictionary _modelBinderDictionary;
private ControllerBuilder _controllerBuilder;
@@ -34,23 +35,27 @@ namespace Orchard.Tests.Environment {
_container = OrchardStarter.CreateHostContainer(
builder => {
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register<StubContainerProvider>().As<IContainerProvider>().ContainerScoped();
builder.Register<StubCompositionStrategy>().As<ICompositionStrategy>().ContainerScoped();
builder.Register<DefaultOrchardHost>().As<IOrchardHost>();
builder.Register<RoutePublisher>().As<IRoutePublisher>();
builder.Register<ModelBinderPublisher>().As<IModelBinderPublisher>();
builder.Register(_controllerBuilder);
builder.Register(_routeCollection);
builder.Register(_modelBinderDictionary);
builder.Register(new ViewEngineCollection { new WebFormViewEngine() });
builder.Register(new StuExtensionManager()).As<IExtensionManager>();
builder.Register(new Mock<IHackInstallationGenerator>().Object);
builder.Register(new StubShellSettingsLoader()).As<IShellSettingsLoader>();
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<StubContainerProvider>().As<IContainerProvider>().InstancePerLifetimeScope();
builder.RegisterType<StubCompositionStrategy>().As<ICompositionStrategy>().InstancePerLifetimeScope();
builder.RegisterType<DefaultOrchardHost>().As<IOrchardHost>().SingleInstance();
builder.RegisterType<RoutePublisher>().As<IRoutePublisher>();
builder.RegisterType<ModelBinderPublisher>().As<IModelBinderPublisher>();
builder.RegisterInstance(_controllerBuilder);
builder.RegisterInstance(_routeCollection);
builder.RegisterInstance(_modelBinderDictionary);
builder.RegisterInstance(new ViewEngineCollection { new WebFormViewEngine() });
builder.RegisterInstance(new StuExtensionManager()).As<IExtensionManager>();
builder.RegisterInstance(new Mock<IHackInstallationGenerator>().Object);
builder.RegisterInstance(new StubShellSettingsLoader()).As<ITenantManager>();
});
_lifetime = _container.BeginLifetimeScope();
var updater = new ContainerUpdater();
updater.RegisterInstance(_container).SingleInstance();
updater.Update(_lifetime);
}
public class StubShellSettingsLoader : IShellSettingsLoader {
public class StubShellSettingsLoader : ITenantManager {
private readonly List<IShellSettings> _shellSettings = new List<IShellSettings>
{new ShellSettings {Name = "testing"}};
@@ -72,6 +77,10 @@ namespace Orchard.Tests.Environment {
return Enumerable.Empty<ExtensionEntry>();
}
public ShellTopology GetExtensionsTopology() {
throw new NotImplementedException();
}
public void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle) {
throw new NotImplementedException();
}
@@ -83,7 +92,7 @@ namespace Orchard.Tests.Environment {
[Test]
public void HostShouldSetControllerFactory() {
var host = _container.Resolve<IOrchardHost>();
var host = _lifetime.Resolve<IOrchardHost>();
Assert.That(_controllerBuilder.GetControllerFactory(), Is.TypeOf<DefaultControllerFactory>());
host.Initialize();
@@ -110,7 +119,7 @@ namespace Orchard.Tests.Environment {
[Test]
public void DifferentShellInstanceShouldBeReturnedAfterEachCreate() {
var host = (DefaultOrchardHost)_container.Resolve<IOrchardHost>();
var host = (DefaultOrchardHost)_lifetime.Resolve<IOrchardHost>();
var runtime1 = host.CreateShell();
var runtime2 = host.CreateShell();
Assert.That(runtime1, Is.Not.SameAs(runtime2));
@@ -119,13 +128,13 @@ namespace Orchard.Tests.Environment {
[Test]
public void NormalDependenciesShouldBeUniquePerRequestContainer() {
var host = (DefaultOrchardHost)_container.Resolve<IOrchardHost>();
var host = (DefaultOrchardHost)_lifetime.Resolve<IOrchardHost>();
var container1 = host.CreateShellContainer();
var container2 = host.CreateShellContainer();
var requestContainer1a = container1.CreateInnerContainer();
var requestContainer1b = container1.CreateInnerContainer();
var requestContainer2a = container2.CreateInnerContainer();
var requestContainer2b = container2.CreateInnerContainer();
var requestContainer1a = container1.BeginLifetimeScope();
var requestContainer1b = container1.BeginLifetimeScope();
var requestContainer2a = container2.BeginLifetimeScope();
var requestContainer2b = container2.BeginLifetimeScope();
var dep1 = container1.Resolve<ITestDependency>();
var dep1a = requestContainer1a.Resolve<ITestDependency>();
@@ -156,13 +165,13 @@ namespace Orchard.Tests.Environment {
}
[Test]
public void SingletonDependenciesShouldBeUniquePerShell() {
var host = (DefaultOrchardHost)_container.Resolve<IOrchardHost>();
var host = (DefaultOrchardHost)_lifetime.Resolve<IOrchardHost>();
var container1 = host.CreateShellContainer();
var container2 = host.CreateShellContainer();
var requestContainer1a = container1.CreateInnerContainer();
var requestContainer1b = container1.CreateInnerContainer();
var requestContainer2a = container2.CreateInnerContainer();
var requestContainer2b = container2.CreateInnerContainer();
var requestContainer1a = container1.BeginLifetimeScope();
var requestContainer1b = container1.BeginLifetimeScope();
var requestContainer2a = container2.BeginLifetimeScope();
var requestContainer2b = container2.BeginLifetimeScope();
var dep1 = container1.Resolve<ITestSingletonDependency>();
var dep1a = requestContainer1a.Resolve<ITestSingletonDependency>();
@@ -171,7 +180,7 @@ namespace Orchard.Tests.Environment {
var dep2a = requestContainer2a.Resolve<ITestSingletonDependency>();
var dep2b = requestContainer2b.Resolve<ITestSingletonDependency>();
Assert.That(dep1, Is.Not.SameAs(dep2));
//Assert.That(dep1, Is.Not.SameAs(dep2));
Assert.That(dep1, Is.SameAs(dep1a));
Assert.That(dep1, Is.SameAs(dep1b));
Assert.That(dep2, Is.SameAs(dep2a));
@@ -179,13 +188,13 @@ namespace Orchard.Tests.Environment {
}
[Test]
public void TransientDependenciesShouldBeUniquePerResolve() {
var host = (DefaultOrchardHost)_container.Resolve<IOrchardHost>();
var host = (DefaultOrchardHost)_lifetime.Resolve<IOrchardHost>();
var container1 = host.CreateShellContainer();
var container2 = host.CreateShellContainer();
var requestContainer1a = container1.CreateInnerContainer();
var requestContainer1b = container1.CreateInnerContainer();
var requestContainer2a = container2.CreateInnerContainer();
var requestContainer2b = container2.CreateInnerContainer();
var requestContainer1a = container1.BeginLifetimeScope();
var requestContainer1b = container1.BeginLifetimeScope();
var requestContainer2a = container2.BeginLifetimeScope();
var requestContainer2b = container2.BeginLifetimeScope();
var dep1 = container1.Resolve<ITestTransientDependency>();
var dep1a = requestContainer1a.Resolve<ITestTransientDependency>();

View File

@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Mvc;
using Autofac;
using NUnit.Framework;
using Orchard.Environment;
@@ -11,7 +8,7 @@ namespace Orchard.Tests.Environment {
public class OrchardStarterTests {
[Test]
public void DefaultOrchardHostInstanceReturnedByCreateHost() {
var host = OrchardStarter.CreateHost(b => b.Register(new ControllerBuilder()));
var host = OrchardStarter.CreateHost(b => b.RegisterInstance(new ControllerBuilder()));
Assert.That(host, Is.TypeOf<DefaultOrchardHost>());
}
}

View File

@@ -17,9 +17,9 @@ namespace Orchard.Tests.Environment.ShellBuilders {
[SetUp]
public void Init() {
_hostContainer = OrchardStarter.CreateHostContainer(builder => {
builder.Register(new ViewEngineCollection());
builder.Register(new RouteCollection());
builder.Register(new ModelBinderDictionary());
builder.RegisterInstance(new ViewEngineCollection());
builder.RegisterInstance(new RouteCollection());
builder.RegisterInstance(new ModelBinderDictionary());
});
}

View File

@@ -1,8 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Autofac;
using Autofac.Builder;
using Autofac.Modules;
using NUnit.Framework;
using Orchard.Extensions;
using Yaml.Grammar;
@@ -18,9 +16,8 @@ namespace Orchard.Tests.Extensions {
public void Init() {
var builder = new ContainerBuilder();
_folders = new StubFolders();
builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.Register(_folders).As<IExtensionFolders>();
builder.Register<ExtensionManager>().As<IExtensionManager>();
builder.RegisterInstance(_folders).As<IExtensionFolders>();
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
_container = builder.Build();
_manager = _container.Resolve<IExtensionManager>();
}
@@ -66,20 +63,132 @@ namespace Orchard.Tests.Extensions {
}
[Test]
public void ExtensionDescriptorsShouldHaveNameAndDescription() {
public void ExtensionDescriptorsShouldHaveNameAndVersion() {
_folders.Manifests.Add("Sample", @"
name: Sample Extension
description: This is the description
version: 2.x
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("Sample"));
Assert.That(descriptor.DisplayName, Is.EqualTo("Sample Extension"));
Assert.That(descriptor.Description, Is.EqualTo("This is the description"));
Assert.That(descriptor.Version, Is.EqualTo("2.x"));
}
[Test]
public void ExtensionDescriptorsShouldBeParsedForMinimalModuleTxt() {
_folders.Manifests.Add("SuperWiki", @"
name: SuperWiki
version: 1.0.3
orchardversion: 1
features:
SuperWiki:
Description: My super wiki module for Orchard.
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Version, Is.EqualTo("1.0.3"));
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
Assert.That(descriptor.Features.Count(), Is.EqualTo(1));
Assert.That(descriptor.Features.First().Name, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().ExtensionName, Is.EqualTo("SuperWiki"));
Assert.That(descriptor.Features.First().Description, Is.EqualTo("My super wiki module for Orchard."));
}
[Test]
public void ExtensionDescriptorsShouldBeParsedForCompleteModuleTxt() {
_folders.Manifests.Add("AnotherWiki", @"
name: AnotherWiki
author: Coder Notaprogrammer
website: http://anotherwiki.codeplex.com
version: 1.2.3
orchardversion: 1
features:
AnotherWiki:
Description: My super wiki module for Orchard.
Dependencies: Versioning, Search
Category: Content types
AnotherWiki Editor:
Description: A rich editor for wiki contents.
Dependencies: TinyMCE, AnotherWiki
Category: Input methods
AnotherWiki DistributionList:
Description: Sends e-mail alerts when wiki contents gets published.
Dependencies: AnotherWiki, Email Subscriptions
Category: Email
AnotherWiki Captcha:
Description: Kills spam. Or makes it zombie-like.
Dependencies: AnotherWiki, reCaptcha
Category: Spam
");
var descriptor = _manager.AvailableExtensions().Single();
Assert.That(descriptor.Name, Is.EqualTo("AnotherWiki"));
Assert.That(descriptor.Author, Is.EqualTo("Coder Notaprogrammer"));
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
Assert.That(descriptor.Features.Count(), Is.EqualTo(4));
foreach (var featureDescriptor in descriptor.Features) {
switch (featureDescriptor.Name) {
case "AnotherWiki":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki"));
Assert.That(featureDescriptor.Description, Is.EqualTo("My super wiki module for Orchard."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Content types"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
Assert.That(featureDescriptor.Dependencies.Contains("Versioning"));
Assert.That(featureDescriptor.Dependencies.Contains("Search"));
break;
case "AnotherWiki Editor":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki"));
Assert.That(featureDescriptor.Description, Is.EqualTo("A rich editor for wiki contents."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Input methods"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
Assert.That(featureDescriptor.Dependencies.Contains("TinyMCE"));
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
break;
case "AnotherWiki DistributionList":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki"));
Assert.That(featureDescriptor.Description, Is.EqualTo("Sends e-mail alerts when wiki contents gets published."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Email"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
Assert.That(featureDescriptor.Dependencies.Contains("Email Subscriptions"));
break;
case "AnotherWiki Captcha":
Assert.That(featureDescriptor.ExtensionName, Is.EqualTo("AnotherWiki"));
Assert.That(featureDescriptor.Description, Is.EqualTo("Kills spam. Or makes it zombie-like."));
Assert.That(featureDescriptor.Category, Is.EqualTo("Spam"));
Assert.That(featureDescriptor.Dependencies.Count(), Is.EqualTo(2));
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
Assert.That(featureDescriptor.Dependencies.Contains("reCaptcha"));
break;
default:
Assert.Fail("Features not parsed correctly");
break;
}
}
}
[Test]
public void ExtensionManagerShouldReturnTopology() {
var topology = _manager.GetExtensionsTopology();
Assert.That(topology.Types.Count(), Is.Not.EqualTo(0));
}
[Test]
public void ExtensionManagerTopologyShouldContainNonAbstractClasses() {
var topology = _manager.GetExtensionsTopology();
foreach (var type in topology.Types) {
Assert.That(type.IsClass);
Assert.That(!type.IsAbstract);
}
}
}
}

View File

@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Autofac.Builder;
using Autofac;
using NUnit.Framework;
using Orchard.Logging;
@@ -14,7 +12,7 @@ namespace Orchard.Tests.Logging {
public void LoggingModuleWillSetLoggerProperty() {
var builder = new ContainerBuilder();
builder.RegisterModule(new LoggingModule());
builder.Register<Thing>();
builder.RegisterType<Thing>();
var container = builder.Build();
var thing = container.Resolve<Thing>();
Assert.That(thing.Logger, Is.Not.Null);
@@ -24,9 +22,9 @@ namespace Orchard.Tests.Logging {
public void LoggerFactoryIsPassedTheTypeOfTheContainingInstance() {
var builder = new ContainerBuilder();
builder.RegisterModule(new LoggingModule());
builder.Register<Thing>();
builder.RegisterType<Thing>();
var stubFactory = new StubFactory();
builder.Register(stubFactory).As<ILoggerFactory>();
builder.RegisterInstance(stubFactory).As<ILoggerFactory>();
var container = builder.Build();
var thing = container.Resolve<Thing>();
@@ -47,7 +45,7 @@ namespace Orchard.Tests.Logging {
public void DefaultLoggerConfigurationUsesCastleLoggerFactoryOverTraceSource() {
var builder = new ContainerBuilder();
builder.RegisterModule(new LoggingModule());
builder.Register<Thing>();
builder.RegisterType<Thing>();
var container = builder.Build();
var thing = container.Resolve<Thing>();
Assert.That(thing.Logger, Is.Not.Null);

View File

@@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Autofac.Builder;
using NUnit.Framework;
using Orchard.Mvc;
using Orchard.Tests.Stubs;
using Autofac;
namespace Orchard.Tests.Mvc {
[TestFixture]
@@ -20,12 +17,12 @@ namespace Orchard.Tests.Mvc {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.Register<ReplacementFooController>().As<IController>()
.Named("controller.orchard.foo")
.FactoryScoped();
builder.RegisterType<ReplacementFooController>()
.Named<IController>("controller.orchard.foo")
.InstancePerDependency();
var container = builder.Build();
_containerProvider = new StubContainerProvider(container, container.CreateInnerContainer());
_containerProvider = new StubContainerProvider(container, container.BeginLifetimeScope());
_controllerFactory = new OrchardControllerFactory();
@@ -66,7 +63,7 @@ namespace Orchard.Tests.Mvc {
Assert.That(controller, Is.TypeOf<ReplacementFooController>());
_controllerFactory.ReleaseController(controller);
_containerProvider.DisposeRequestContainer();
_containerProvider.EndRequestLifetime();
// explicitly dispose a few more, just to make sure it's getting hit from all different directions
((IDisposable) controller).Dispose();

View File

@@ -1,9 +1,9 @@
using System.Linq;
using System.Web.Mvc;
using Autofac;
using NUnit.Framework;
using Orchard.Mvc;
using Orchard.Extensions;
using Autofac.Core;
namespace Orchard.Tests.Mvc {
[TestFixture] public class OrchardControllerIdentificationStrategyTests {
@@ -12,7 +12,7 @@ namespace Orchard.Tests.Mvc {
var strategy = new OrchardControllerIdentificationStrategy(Enumerable.Empty<ExtensionEntry>());
var service = strategy.ServiceForControllerType(typeof (StrategyTestingController));
Assert.That(service, Is.TypeOf<NamedService>());
Assert.That(((NamedService)service).ServiceName, Is.EqualTo("controller.orchard.tests.strategytesting"));
Assert.That(((NamedService)service).ServiceName, Is.EqualTo("controller.orchard.framework.tests.strategytesting"));
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web.Mvc;

View File

@@ -54,6 +54,10 @@ namespace Orchard.Tests.Mvc.Routes {
};
}
public ShellTopology GetExtensionsTopology() {
throw new NotImplementedException();
}
public void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle) {
throw new NotImplementedException();
}

View File

@@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Tests</RootNamespace>
<AssemblyName>Orchard.Tests</AssemblyName>
<AssemblyName>Orchard.Framework.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@@ -31,14 +31,26 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=1.4.4.561, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<Reference Include="Autofac, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.Web, Version=1.4.4.561, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<Reference Include="Autofac.Integration.Web, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.Integration.Web.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.Web.Mvc, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.Integration.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Castle Windsor 2.0\bin\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Castle Windsor 2.0\bin\Castle.DynamicProxy2.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
@@ -103,6 +115,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\CommandHandlerDescriptorBuilderTests.cs" />
<Compile Include="Commands\CommandHandlerTests.cs" />
<Compile Include="Commands\CommandManagerTests.cs" />
<Compile Include="ContentManagement\ContentQueryTests.cs">
<SubType>Code</SubType>
</Compile>
@@ -138,7 +153,9 @@
<Compile Include="Data\Builders\SessionFactoryBuilderTests.cs" />
<Compile Include="Data\RepositoryTests.cs" />
<Compile Include="Data\StubLocator.cs" />
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyTests.cs" />
<Compile Include="Environment\Configuration\AppDataFolderTests.cs" />
<Compile Include="Environment\Configuration\DefaultTenantManagerTests.cs" />
<Compile Include="Environment\DefaultCompositionStrategyTests.cs" />
<Compile Include="Environment\DefaultOrchardHostTests.cs" />
<Compile Include="Environment\DefaultOrchardShellTests.cs" />
@@ -180,9 +197,9 @@
<Compile Include="Utility\ReflectTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard\Orchard.csproj">
<ProjectReference Include="..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard</Name>
<Name>Orchard.Framework</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>

View File

@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Orchard.Tests")]
[assembly: AssemblyTitle("Orchard.Framework.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Orchard")]

View File

@@ -3,17 +3,17 @@ using Autofac.Integration.Web;
namespace Orchard.Tests.Stubs {
public class StubContainerProvider : IContainerProvider {
public StubContainerProvider(IContainer applicationContainer, IContainer requestContainer) {
public StubContainerProvider(IContainer applicationContainer, ILifetimeScope requestContainer) {
ApplicationContainer = applicationContainer;
RequestContainer = requestContainer;
RequestLifetime = requestContainer;
}
public void DisposeRequestContainer() {
RequestContainer.Dispose();
public void EndRequestLifetime() {
RequestLifetime.Dispose();
}
public IContainer ApplicationContainer { get; set; }
public IContainer RequestContainer { get; set; }
public ILifetimeScope RequestLifetime { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Autofac;
using Autofac.Builder;
using Moq;
using NUnit.Framework;
@@ -13,7 +14,7 @@ namespace Orchard.Tests.Tasks {
var taskManager = new Mock<IBackgroundService>();
var builder = new ContainerBuilder();
builder.Register(taskManager.Object);
builder.RegisterInstance(taskManager.Object);
var container = builder.Build();
var heartbeatSource = new SweepGenerator(container);
@@ -26,7 +27,7 @@ namespace Orchard.Tests.Tasks {
var taskManager = new Mock<IBackgroundService>();
var builder = new ContainerBuilder();
builder.Register(taskManager.Object);
builder.RegisterInstance(taskManager.Object);
var container = builder.Build();
var heartbeatSource = new SweepGenerator(container) {

View File

@@ -1,5 +1,5 @@
using NUnit.Framework;
using Orchard.Extensions;
using Orchard.Utility.Extensions;
namespace Orchard.Tests.Utility.Extensions {
[TestFixture]

Some files were not shown because too many files have changed in this diff Show More