Compare commits

...

71 Commits

Author SHA1 Message Date
Benedek Farkas
6f27eb2c4c Updating Orchard.Tests.ContentManagement.HqlExpressionTests.ShouldSortRandomly to decrease failure chance due to randomness 2024-03-08 11:41:17 +01:00
Benedek Farkas
7bbc12d3b8 Adding workflow to run specflow tests as a nightly build 2024-03-08 11:03:02 +01:00
Benedek Farkas
a3e6e4887f Revert "Testing the branch strategy matrix concept to be used for the nightly build"
This reverts commit 1354e367b7.
2024-03-08 10:57:07 +01:00
Benedek Farkas
1354e367b7 Testing the branch strategy matrix concept to be used for the nightly build 2024-03-08 10:49:36 +01:00
Benedek Farkas
1ad1aa278e Removing SpecFlow test execution from the compile workflow 2024-03-08 10:49:08 +01:00
Benedek Farkas
844b60059e Upgrading actions to latest versions
These actions generated the Node.js 16  deprecation warning
2024-03-08 10:48:48 +01:00
Benedek Farkas
984a8ca0ac Merge branch 'dev' into issue/8686-dev 2024-03-07 19:41:28 +01:00
Benedek Farkas
64eafbcea8 Merge branch 'issue/8684' into issue/8686-dev 2023-07-19 15:46:28 +02:00
Benedek Farkas
824846036e Merge branch 'dev' into issue/8686-dev 2023-06-29 10:54:20 +02:00
Benedek Farkas
19847d2e95 Merge branch 'issue/8684' into issue/8686-dev
# Conflicts:
#	.github/workflows/compile.yml
#	src/Orchard.Specs/Hosting/Orchard.Web/Web.config
#	src/Orchard.Web/Modules/Orchard.JobsQueue/Tests/Orchard.Messaging.Tests.csproj
2023-06-28 17:18:13 +02:00
Benedek Farkas
cb12c378fb Re-enabling the Spec step 2023-05-26 15:31:56 +02:00
Benedek Farkas
2e22e5c86f Specs: Updating the Newtonsoft.Json binding redirect in the spec app's web.config 2023-05-26 15:16:15 +02:00
Benedek Farkas
9c8e5594cf Fixing that MembershipServiceTests should use IPasswordService, also making SaltAndPasswordShouldBeDifferentEvenWithSameSourcePassword test parameters more readable 2023-05-26 15:05:11 +02:00
Benedek Farkas
17bd0e58e4 Fixing initialization errors in AccountControllerTests 2023-05-26 15:04:35 +02:00
Benedek Farkas
d14aafba8e Fixing initialization errors in ShellDescriptorManagerTests 2023-05-26 15:03:10 +02:00
Benedek Farkas
9934255e6f Fixing initialization errors in ModuleStepTest and ThemeStepTest 2023-05-26 15:02:36 +02:00
Benedek Farkas
03a0361d76 Orchard.Tests.Modules: Adding missing reference to Iesi.Collections (that doesn't cause a build error, just when running tests) 2023-05-26 14:54:43 +02:00
Benedek Farkas
68a03c5675 Updating Orchard.Tests/UI/Resources/ResourceManagerTests.cs according to ResourceManager API change in ac11024be4
and removing obsolete tests
2023-05-26 12:49:32 +02:00
Benedek Farkas
63634d3a4d Code styling and fixing warning in Orchard.Tests/UI/Resources/ResourceManagerTests.cs 2023-05-26 12:35:24 +02:00
Benedek Farkas
4962a66c12 Fixing Orchard.Tests.Localization.TextTests 2023-05-26 12:00:09 +02:00
Benedek Farkas
c11688a26b Fixing initialization errors in FeatureManagerTests 2023-05-26 11:21:43 +02:00
Benedek Farkas
f367a79834 Fixing initialization error error in StylesheetBindingStrategyTests 2023-05-26 11:21:09 +02:00
Benedek Farkas
392afad570 Fixing HqlExpressionTests.AllDataTypesCanBeQueried 2023-05-26 11:17:48 +02:00
Benedek Farkas
e9886f0b9b Re-enabling the Test step 2023-05-26 11:08:23 +02:00
Benedek Farkas
be828e9ff9 Adding System.Net.Http 4.2.0.0 reference to Orchard.Email's web.config to fix Razor compilation warning 2023-05-26 10:50:10 +02:00
Benedek Farkas
b1d058173e Disabling the Test step for now 2023-05-26 10:47:04 +02:00
Benedek Farkas
9a487037b8 Updating Newtonsoft.Json reference in Orchard.Messaging.Tests.csproj 2023-05-26 10:44:19 +02:00
Benedek Farkas
ec3916307e Merge branch 'issue/8686' into issue/8686-dev
# Conflicts:
#	src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj
#	src/Orchard.Azure/Orchard.Azure.Web/packages.config
2023-05-26 10:42:46 +02:00
Benedek Farkas
9d2bb2bec5 Fixing Newtonsoft.Json references 2023-05-26 10:32:13 +02:00
Benedek Farkas
810e5f7cc0 Fixing outdated assembly binding redirects 2023-05-25 20:48:08 +02:00
Benedek Farkas
9340a021c1 Merge branch 'issue/8686' into issue/8686-dev
# Conflicts:
#	.github/workflows/compile.yml
#	src/Orchard.Azure/Orchard.Azure.Web/Orchard.Azure.Web.csproj
#	src/Orchard.Azure/Orchard.Azure.Web/packages.config
#	src/Orchard.Specs/Blogs.feature.cs
#	src/Orchard.Specs/DateTime.feature
#	src/Orchard.Specs/DateTime.feature.cs
#	src/Orchard.Specs/Hosting/Orchard.Web/Web.config
#	src/Orchard.Web/Web.config
2023-05-25 20:45:03 +02:00
Benedek Farkas
5d911c2193 Orchard.Specs: Updating Settings.AddingANewSiteCultureAndSelectingItAsTheDefaultWorks to correctly detect that a culture that wasn't added before can be set as default 2023-05-24 21:17:56 +02:00
Benedek Farkas
6e8d7d2d50 Orchard.Specs: Updating DateTime.CreatingAndUsingDateTimeFieldsInAnotherCulture structure without functional change 2023-05-24 21:06:53 +02:00
Benedek Farkas
75e17d410c Orchard.Specs: Adding Settings feature 2023-05-24 20:53:30 +02:00
Benedek Farkas
d266db61de Revert "Marking System.Net.Http references as private (copy local) to make sure that it's always available, because it requires a specific version"
This reverts commit e4f5632236.
2023-05-24 20:41:53 +02:00
Benedek Farkas
e4f5632236 Marking System.Net.Http references as private (copy local) to make sure that it's always available, because it requires a specific version 2023-05-24 16:14:25 +02:00
Benedek Farkas
70ed140231 Re-enabling the Specs step 2023-05-24 13:07:17 +02:00
Benedek Farkas
f610c53bcf Re-enabling the Test step 2023-05-24 12:48:27 +02:00
Benedek Farkas
86c7350358 Pinning the referenced version of System.Net.Http to 4.2.0.0 to prevent Razor compilation warning
System.Net.Http is known to have such problems across different framework versions ways of referencing it

The original warning is:
ASPNETCOMPILER : error : The following assembly has dependencies on a version of the .NET Framework that is higher than the target and might not load correctly during runtime causing a failure: Orchard.Workflows, Version=1.10.3.0, Culture=neutral, PublicKeyToken=null. The dependencies are: System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. You should either ensure that the dependent assembly is correct for the target framework, or ensure that the target framework you are addressing is that of the dependent assembly. [D:\a\Orchard\Orchard\src\Orchard.Web\Modules\Orchard.Workflows\Orchard.Workflows.csproj
2023-05-24 12:30:14 +02:00
Benedek Farkas
d2eccf5c2c Adding step to the Compile workflow to upload the MSBuild binlog results 2023-05-23 20:15:16 +02:00
Benedek Farkas
a912162e96 Specs: Media test simplified since the Orchard.Media feature is deprecated 2023-05-23 19:51:17 +02:00
Benedek Farkas
62b2f65112 Specs: Fixing "I can create browse blog posts on several pages" Blog test's flakyness due to timing
because the blog posts are created quickly after one another and the lack of millisecond-precision can cause
the blog posts to appear out of order of creation
2023-05-23 17:39:05 +02:00
Benedek Farkas
3aaf2272e1 Specs: Fixing "I can create browse blog posts on several pages" Blog test's usage of "I should not see" and correcting the parameters too
because unlike "I should see", this is not a regex match, just contains
2023-05-23 17:36:18 +02:00
Benedek Farkas
29f58677a3 Moving the System.Net.Http assembly redirect to Orchard.Web 2023-05-23 17:29:59 +02:00
Benedek Farkas
0fd452a4f9 Orchard.Workflows: Adding assembly binding redirect for System.Net.Http to avoid Razor compilation warning 2023-05-23 15:43:24 +02:00
Benedek Farkas
e22e2dbe72 Orchard.Framework: Making the System.Net.Http not-private to prevent an outdated version sticking around 2023-05-23 14:29:36 +02:00
Benedek Farkas
99190fe4e5 Disabling Test and Spec execution for now 2023-05-23 14:18:39 +02:00
Benedek Farkas
3f214897eb Reverting the addition of assembly binding redirects to Orchard.Specs/Hosting/Simple.Web/Web.config
since it doesn't need them like Orchard.Specs/Hosting/Orchard.Web/Web.config does
2023-05-23 12:52:41 +02:00
Benedek Farkas
ae7763eb7c Revert "Upgrading Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 4.1.0 (latest) to get rid of old System.Http.Net dependency"
This reverts commit be2ba866e3.
2023-05-23 12:45:33 +02:00
Benedek Farkas
ddd08c227d Revert "Replacing System.Net.Http references with its NuGet package to pin the correct version number (experimental)"
This reverts commit 087f2849b1.
2023-05-23 12:45:19 +02:00
Benedek Farkas
6bda87d680 Orchard.Specs/Hosting/Orchard.Web/Global.asax.cs: Workaround for AntiForgeryToken bug in ASP.NET MVC since version 5.2.4
https://github.com/aspnet/AspNetWebStack/issues/162
2023-05-23 12:44:59 +02:00
Benedek Farkas
975a802ed0 Restoring Orchard.Specs/Hosting/Orchard.Web/Web.config to match Orchard.Web's web.config closer
so that it loads assemblies from the Dependencies folder.
This fixes the error with Autofac not being able to resolve dependencies for DefaultOrchardShell
2023-05-23 12:42:26 +02:00
Benedek Farkas
8446bb94d3 Fixing compile workflow to also mark Razor compilation warnings as errors 2023-05-23 12:33:49 +02:00
Benedek Farkas
b714a44feb Fixing Test step 2023-05-19 11:43:50 +02:00
Benedek Farkas
5065e8fb20 Compile workflow: Testing the Test and Spec targets 2023-05-19 11:34:44 +02:00
Benedek Farkas
12d7494a54 Orchard.proj: Spec target actually depends on only the Compile target, not Package-Stage (experimental) 2023-05-19 11:33:57 +02:00
Benedek Farkas
be2ba866e3 Upgrading Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 4.1.0 (latest) to get rid of old System.Http.Net dependency 2023-05-18 21:28:32 +02:00
Benedek Farkas
087f2849b1 Replacing System.Net.Http references with its NuGet package to pin the correct version number (experimental) 2023-05-18 19:11:35 +02:00
Benedek Farkas
605551dde2 Removing unused references to System.Net.Http 2023-05-18 19:10:13 +02:00
Benedek Farkas
7e3d1c8cbc Adding msbuild to PATH 2023-05-18 17:26:09 +02:00
Benedek Farkas
9f86b7dc0f Changing default shell to pwsh (msbuild was not found in cmd?) 2023-05-18 16:58:37 +02:00
Benedek Farkas
c821afa9a5 Adding the compile workflow's actual contents 2023-05-18 16:45:50 +02:00
Benedek Farkas
42f04dd11b Adding empty compile workflow from dev 2023-05-18 16:30:17 +02:00
Benedek Farkas
aa71039416 Orchard.Specs: Fixing assembly loading errors when starting up the web host by adding binding redirects 2023-05-18 12:34:51 +02:00
Benedek Farkas
eeb2e4764a Updating Orchard.Azure.Web's required version of System.Web.Mvc to match the rest of the solution 2023-05-18 09:49:42 +02:00
Benedek Farkas
6ab590bc7a Fixing indentation in DefaultDateFormatterTests 2023-05-17 22:24:56 +02:00
Benedek Farkas
bbafeded05 Fixing CurrentCultureWorkContextTests 2023-05-17 21:43:17 +02:00
Benedek Farkas
5f0c0c2fec Fixing that test cases for invalid path in FileSystemStorageProviderTests broke in a3e9bef3ca (issue #6802, PR #6919)
I should review PRs more carefully!
2023-05-17 21:04:07 +02:00
Benedek Farkas
d1043b9f4f Fixing typo in CommonPartProviderTests.UpdateModelStub class name 2023-05-17 21:03:12 +02:00
Benedek Farkas
077bfa6ae0 Fixing OwnerEditor tests in CommonPartProviderTests as the owner editor now checks for a different permission since 5b0c82d1ad 2023-05-17 21:02:52 +02:00
Benedek Farkas
8d7a35b0f0 Fixing that RecipeManagerTests failed due to HttpContext not being available 2023-05-17 20:41:46 +02:00
21 changed files with 252 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
name: Compile
# Compiles the solution and runs unit tests.
on:
workflow_dispatch:
@@ -18,13 +19,16 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Restore NuGet packages
run: nuget restore src/Orchard.sln
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3.1
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
- name: Compile
run: msbuild Orchard.proj /m /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
- name: Test
run: msbuild Orchard.proj /m /t:Test

39
.github/workflows/specflow.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: SpecFlow tests
# Compiles the solution and runs unit tests, as well the SpecFlow tests on the main development branches.
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Every day at midnight.
jobs:
compile:
name: SpecFlow tests
defaults:
run:
shell: pwsh
runs-on: windows-latest
strategy:
matrix:
branch: [dev, 1.10.x]
steps:
- name: Clone repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ matrix.branch }}
- name: Restore NuGet packages
run: nuget restore src/Orchard.sln
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
- name: Compile
run: msbuild Orchard.proj /m /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
- name: Test
run: msbuild Orchard.proj /m /t:Test
- name: Spec
run: msbuild Orchard.proj /m /t:Spec

View File

@@ -164,7 +164,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />

View File

@@ -200,6 +200,11 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Settings.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Settings.feature</DependentUpon>
</Compile>
<Compile Include="Text.feature.cs">
<DependentUpon>Text.feature</DependentUpon>
<AutoGen>True</AutoGen>
@@ -372,6 +377,10 @@
<DependentUpon>HostComponents.config</DependentUpon>
</None>
<None Include="packages.config" />
<None Include="Settings.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Settings.feature.cs</LastGenOutput>
</None>
<None Include="Text.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Text.feature.cs</LastGenOutput>

View File

@@ -0,0 +1,14 @@
Feature: Settings
In order to manage my site
As a privileged user
I want to be able to see and change site settings
Scenario: Adding a new site culture and selecting it as the default works
Given I have installed Orchard
When I go to "Admin/Settings/Index"
Then I should not see "hu-HU"
When I have "hu-HU" as the default culture
And I go to "Admin/Settings/Index"
Then I should see "<option selected="selected">hu-HU</option>"

93
src/Orchard.Specs/Settings.feature.cs generated Normal file
View File

@@ -0,0 +1,93 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.9.0.77
// SpecFlow Generator Version:1.9.0.0
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.9.0.77")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Settings")]
public partial class SettingsFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "Settings.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"), "Settings", "\r\nIn order to manage my site\r\nAs a privileged user\r\nI want to be able to see and " +
"change site settings", ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.TestFixtureTearDownAttribute()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
[NUnit.Framework.SetUpAttribute()]
public virtual void TestInitialize()
{
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
public virtual void ScenarioCleanup()
{
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Adding a new site culture and selecting it as the default works")]
public virtual void AddingANewSiteCultureAndSelectingItAsTheDefaultWorks()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Adding a new site culture and selecting it as the default works", ((string[])(null)));
#line 7
this.ScenarioSetup(scenarioInfo);
#line 9
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 10
testRunner.When("I go to \"Admin/Settings/Index\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 11
testRunner.Then("I should not see \"hu-HU\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 12
testRunner.When("I have \"hu-HU\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 13
testRunner.And("I go to \"Admin/Settings/Index\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 14
testRunner.Then("I should see \"<option selected=\"selected\">hu-HU</option>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
}
}
#pragma warning restore
#endregion

View File

@@ -80,6 +80,9 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\packages\Iesi.Collections.4.0.4\lib\net461\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="IronRuby, Version=1.1.3.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<HintPath>..\packages\IronRuby.1.1.3\lib\IronRuby.dll</HintPath>
</Reference>

View File

@@ -19,6 +19,7 @@ using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features;
using Orchard.Environment.State;
using Orchard.Events;
using Orchard.Locking;
using Orchard.Packaging.GalleryServer;
using Orchard.Packaging.Models;
using Orchard.Packaging.Services;
@@ -57,6 +58,7 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
builder.RegisterType<RecipeExecutionLogger>().AsSelf();
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
builder.RegisterType<FeatureManager>().As<IFeatureManager>();
builder.RegisterType<LockingProvider>().As<ILockingProvider>();
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
builder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
builder.RegisterType<StubAsyncTokenProvider>().As<IAsyncTokenProvider>();
@@ -65,6 +67,7 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
builder.RegisterInstance(_packagesInRepository).As<IPackagingSourceManager>();
builder.RegisterInstance(_packageManager).As<IPackageManager>();
builder.RegisterType<ShellStateManager>().As<IShellStateManager>().SingleInstance();
builder.RegisterType<Signals>().As<ISignals>().SingleInstance();
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();
builder.RegisterType<ModuleStep>();
builder.RegisterSource(new EventsRegistrationSource());

View File

@@ -19,6 +19,7 @@ using Orchard.Environment.Features;
using Orchard.Environment.State;
using Orchard.Events;
using Orchard.FileSystems.VirtualPath;
using Orchard.Locking;
using Orchard.Packaging.GalleryServer;
using Orchard.Packaging.Services;
using Orchard.Recipes.Models;
@@ -60,6 +61,7 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
builder.RegisterType<RecipeExecutionLogger>().AsSelf();
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
builder.RegisterType<FeatureManager>().As<IFeatureManager>();
builder.RegisterType<LockingProvider>().As<ILockingProvider>();
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
builder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
builder.RegisterType<StubAsyncTokenProvider>().As<IAsyncTokenProvider>();
@@ -71,6 +73,7 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
builder.RegisterInstance(testVirtualPathProvider).As<IVirtualPathProvider>();
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();
builder.RegisterType<ThemeService>().As<IThemeService>();
builder.RegisterType<Signals>().As<ISignals>().SingleInstance();
builder.RegisterType<StubOrchardServices>().As<IOrchardServices>();
builder.RegisterType<StubSiteThemeService>().As<ISiteThemeService>();
builder.RegisterType<ThemeStep>();

View File

@@ -14,6 +14,7 @@ using Orchard.Environment.Descriptor.Models;
using Orchard.Events;
using Orchard.Caching;
using Orchard.Core.Settings.State.Records;
using Orchard.Locking;
namespace Orchard.Tests.Modules.Settings.Blueprint {
[TestFixture]
@@ -24,6 +25,8 @@ namespace Orchard.Tests.Modules.Settings.Blueprint {
builder.RegisterType<DefaultCacheManager>().As<ICacheManager>();
builder.RegisterType<DefaultCacheHolder>().As<ICacheHolder>().SingleInstance();
builder.RegisterType<DefaultCacheContextAccessor>().As<ICacheContextAccessor>();
builder.RegisterType<LockingProvider>().As<ILockingProvider>();
builder.RegisterType<Signals>().As<ISignals>().SingleInstance();
builder.RegisterType<ShellDescriptorManager>().As<IShellDescriptorManager>().SingleInstance();
builder.RegisterType<ShellStateManager>().As<IShellStateManager>().SingleInstance();
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();

View File

@@ -71,6 +71,8 @@ namespace Orchard.Tests.Modules.Users.Controllers {
builder.RegisterType<UserPartHandler>().As<IContentHandler>();
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
builder.RegisterType<AccountValidationService>().As<IAccountValidationService>();
builder.RegisterType<PasswordService>().As<IPasswordService>();
builder.RegisterType<PasswordHistoryService>().As<IPasswordHistoryService>();
builder.RegisterInstance(new Work<IEnumerable<IShapeTableEventHandler>>(resolve => _container.Resolve<IEnumerable<IShapeTableEventHandler>>())).AsSelf();
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();

View File

@@ -68,6 +68,7 @@ namespace Orchard.Tests.Modules.Users.Services
//builder.RegisterModule(new ImplicitCollectionSupportModule());
builder.RegisterType<MembershipValidationService>().As<IMembershipValidationService>();
builder.RegisterType<MembershipService>().As<IMembershipService>();
builder.RegisterType<PasswordService>().As<IPasswordService>();
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
@@ -77,7 +78,6 @@ namespace Orchard.Tests.Modules.Users.Services
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
builder.RegisterInstance(new ShellSettings { Name = ShellSettings.DefaultName, DataProvider = "SqlCe" });
builder.RegisterType<UserPartHandler>().As<IContentHandler>();
//builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
builder.RegisterAutoMocking(MockBehavior.Loose);
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
@@ -135,11 +135,12 @@ namespace Orchard.Tests.Modules.Users.Services
[Test]
public void SaltAndPasswordShouldBeDifferentEvenWithSameSourcePassword() {
var user1 = _membershipService.CreateUser(new CreateUserParams("a", "b", "c", null, null, true, false));
var password = "Password1!";
var user1 = _membershipService.CreateUser(new CreateUserParams("user1", password, "user1@email.com", null, null, true, false));
_session.Flush();
_session.Clear();
var user2 = _membershipService.CreateUser(new CreateUserParams("d", "b", "e", null, null, true, false));
var user2 = _membershipService.CreateUser(new CreateUserParams("user2", password, "user2@email.com", null, null, true, false));
_session.Flush();
_session.Clear();
@@ -150,8 +151,8 @@ namespace Orchard.Tests.Modules.Users.Services
Assert.That(user1Record.Password, Is.Not.EqualTo(user2Record.Password));
List<LocalizedString> validationErrors;
Assert.That(_membershipService.ValidateUser("a", "b", out validationErrors), Is.Not.Null);
Assert.That(_membershipService.ValidateUser("d", "b", out validationErrors), Is.Not.Null);
Assert.That(_membershipService.ValidateUser("user1", password, out validationErrors), Is.Not.Null);
Assert.That(_membershipService.ValidateUser("user2", password, out validationErrors), Is.Not.Null);
}
[Test]

View File

@@ -106,7 +106,10 @@ namespace Orchard.Tests.ContentManagement {
[Test]
public void AllDataTypesCanBeQueried() {
var dt = DateTime.Now;
var now = DateTime.Now;
// NHibernate stores DateTime values with seconds-precision, so everything below that needs to be truncated
// so that the query works correctly. Thanks to https://stackoverflow.com/a/1005222 for elegant solution.
now = now.AddTicks(-(now.Ticks % TimeSpan.TicksPerSecond));
_manager.Create<LambdaPart>("lambda", init => {
init.Record.BooleanStuff = true;
@@ -116,7 +119,7 @@ namespace Orchard.Tests.ContentManagement {
init.Record.IntegerStuff = 0;
init.Record.LongStuff = 0;
init.Record.StringStuff = "0";
init.Record.DateTimeStuff = dt;
init.Record.DateTimeStuff = now;
});
_session.Flush();
@@ -144,7 +147,7 @@ namespace Orchard.Tests.ContentManagement {
lambda = _manager.HqlQuery().Where(alias => alias.ContentPartRecord<LambdaRecord>(), x => x.Eq("StringStuff", "0")).List();
Assert.That(lambda.Count(), Is.EqualTo(1));
lambda = _manager.HqlQuery().Where(alias => alias.ContentPartRecord<LambdaRecord>(), x => x.Eq("DateTimeStuff", dt)).List();
lambda = _manager.HqlQuery().Where(alias => alias.ContentPartRecord<LambdaRecord>(), x => x.Eq("DateTimeStuff", now)).List();
Assert.That(lambda.Count(), Is.EqualTo(1));
}
@@ -940,31 +943,29 @@ namespace Orchard.Tests.ContentManagement {
}
[Test]
// This is a potentially flaky test, but failure due to randomness is extremely unlikely.
public void ShouldSortRandomly() {
_manager.Create<LambdaPart>("lambda", init => {
init.Record.IntegerStuff = 1;
});
_manager.Create<LambdaPart>("lambda", init => {
init.Record.IntegerStuff = 2;
});
_manager.Create<LambdaPart>("lambda", init => {
init.Record.IntegerStuff = 3;
});
_session.Flush();
var result = _manager.HqlQuery().ForType("lambda").List();
Assert.That(result.Count(), Is.EqualTo(3));
var firstResults = new List<int>();
for (int i = 0; i < 10; i++) {
result = _manager.HqlQuery().Join(alias => alias.ContentPartRecord<LambdaRecord>()).OrderBy(x => x.Named("civ"), order => order.Random()).List();
firstResults.Add(result.First().As<LambdaPart>().Record.IntegerStuff);
var itemCount = 10;
for (int i = 0; i < itemCount; i++) {
_manager.Create<LambdaPart>("lambda", init => {
init.Record.IntegerStuff = i;
});
}
Assert.That(firstResults.Distinct().Count(), Is.GreaterThan(1));
_session.Flush();
var items = _manager.HqlQuery().ForType("lambda").List();
Assert.That(items.Count(), Is.EqualTo(itemCount));
var results = new List<string>();
for (int i = 0; i < 10; i++) {
items = _manager.HqlQuery().Join(alias =>
alias.ContentPartRecord<LambdaRecord>()).OrderBy(x => x.Named("civ"), order => order.Random()).List();
results.Add(string.Join("", items.Select(item => item.As<LambdaPart>().Record.IntegerStuff)));
}
Assert.That(results.Distinct().Count(), Is.GreaterThan(1));
}
[Test]

View File

@@ -8,10 +8,13 @@ using NUnit.Framework;
using Orchard.DisplayManagement.Descriptors;
using Orchard.DisplayManagement.Descriptors.ResourceBindingStrategy;
using Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy;
using Orchard.Environment;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.VirtualPath;
using Orchard.Tests.Localization;
using Orchard.UI.Resources;
namespace Orchard.Tests.DisplayManagement.Descriptors {
[TestFixture]
@@ -29,8 +32,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
builder.Register(ctx => _descriptor);
builder.RegisterType<StylesheetBindingStrategy>().As<IShapeTableProvider>();
builder.RegisterType<ResourceFileHashProvider>().As<IResourceFileHashProvider>();
builder.RegisterInstance(_testViewEngine).As<IShapeTemplateViewEngine>();
builder.RegisterInstance(_testVirtualPathProvider).As<IVirtualPathProvider>();
builder.RegisterInstance(new Work<WorkContext>(resolve => new StubWorkContext())).AsSelf();
var extensionManager = new Mock<IExtensionManager>();
builder.Register(ctx => extensionManager);

View File

@@ -16,6 +16,7 @@ using Orchard.Environment.Extensions.Folders;
using Orchard.Environment.Features;
using Orchard.Environment.State;
using Orchard.Events;
using Orchard.Locking;
using Orchard.Tests.Environment.Extensions;
using Orchard.Tests.Stubs;
@@ -27,10 +28,10 @@ namespace Orchard.Tests.Environment.Features {
protected override IEnumerable<Type> DatabaseTypes {
get {
return new[] {
typeof (ShellDescriptorRecord),
typeof (ShellFeatureRecord),
typeof (ShellParameterRecord),
};
typeof (ShellDescriptorRecord),
typeof (ShellFeatureRecord),
typeof (ShellParameterRecord),
};
}
}
@@ -39,11 +40,13 @@ namespace Orchard.Tests.Environment.Features {
builder.RegisterInstance(_folders).As<IExtensionFolders>();
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
builder.RegisterType<FeatureManager>().As<IFeatureManager>();
builder.RegisterType<LockingProvider>().As<ILockingProvider>();
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
builder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
builder.RegisterType<StubAsyncTokenProvider>().As<IAsyncTokenProvider>();
builder.RegisterType<ShellDescriptorManager>().As<IShellDescriptorManager>().SingleInstance();
builder.RegisterType<ShellStateManager>().As<IShellStateManager>().SingleInstance();
builder.RegisterType<Signals>().As<ISignals>().SingleInstance();
builder.RegisterType<StubEventBus>().As<IEventBus>().SingleInstance();
builder.RegisterSource(new EventsRegistrationSource());

View File

@@ -1,12 +1,11 @@
using Autofac;
using System.Collections.Generic;
using System.Web;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.Localization;
using Orchard.Localization.Services;
using Orchard.Mvc;
using Orchard.Tests.Stubs;
using System.Collections.Generic;
using System.Web;
namespace Orchard.Tests.Localization {
[TestFixture]
@@ -18,7 +17,7 @@ namespace Orchard.Tests.Localization {
public void Init() {
var mockLocalizedManager = new Mock<ILocalizedStringManager>();
mockLocalizedManager
.Setup(x => x.GetLocalizedString(new List<string> { It.IsAny<string>() }, It.IsAny<string>(), It.IsAny<string>()))
.Setup(x => x.GetLocalizedString(It.IsAny<IEnumerable<string>>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns(new FormatForScope("foo {0}", null));
var builder = new ContainerBuilder();
@@ -38,8 +37,7 @@ namespace Orchard.Tests.Localization {
}
[Test]
public void TextDoesEncodeHtmlEncodedArguments()
{
public void TextDoesEncodeHtmlEncodedArguments() {
Assert.That(_text.Get("foo {0}", new HtmlString("bar")).Text, Is.EqualTo("foo bar"));
Assert.That(_text.Get("foo {0}", new HtmlString("<bar>")).Text, Is.EqualTo("foo <bar>"));
}

View File

@@ -13,7 +13,7 @@ namespace Orchard.Tests.UI.Resources {
private IResourceManager _resourceManager;
private IResourceFileHashProvider _resourceFileHashProvider;
private TestManifestProvider _testManifest;
private string _appPath = "/AppPath/";
private readonly string _appPath = "/AppPath/";
private class TestManifestProvider : IResourceManifestProvider {
public Action<ResourceManifest> DefineManifest { get; set; }
@@ -30,10 +30,6 @@ namespace Orchard.Tests.UI.Resources {
}
private void VerifyPaths(string resourceType, RequireSettings defaultSettings, string expectedPaths) {
VerifyPaths(resourceType, defaultSettings, expectedPaths, false);
}
private void VerifyPaths(string resourceType, RequireSettings defaultSettings, string expectedPaths, bool ssl) {
defaultSettings = defaultSettings ?? new RequireSettings();
var requiredResources = _resourceManager.BuildRequiredResources(resourceType);
var renderedResources = string.Join(",", requiredResources.Select(context => context
@@ -57,90 +53,68 @@ namespace Orchard.Tests.UI.Resources {
[Test]
public void ReleasePathIsTheDefaultPath() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
};
_testManifest.DefineManifest = m => m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", null, "script1.min.js");
}
[Test]
public void DebugPathIsUsedWithDebugMode() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
};
_testManifest.DefineManifest = m => m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { DebugMode = true }, "script1.js");
}
[Test]
public void ReleasePathIsUsedWhenNoDebugPath() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js");
};
_testManifest.DefineManifest = m => m.DefineResource("script", "Script1").SetUrl("script1.min.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { DebugMode = true }, "script1.min.js");
}
[Test]
public void DefaultSettingsAreOverriddenByUseDebugMode() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
};
_testManifest.DefineManifest = m => m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
_resourceManager.Require("script", "Script1").UseDebugMode();
VerifyPaths("script", new RequireSettings { DebugMode = false }, "script1.js");
}
[Test]
public void CdnPathIsUsedInCdnMode() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.js").SetCdn("http://cdn/script1.min.js");
};
_testManifest.DefineManifest = m => m
.DefineResource("script", "Script1")
.SetUrl("script1.js")
.SetCdn("http://cdn/script1.min.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true }, "http://cdn/script1.min.js");
}
[Test]
public void CdnSslPathIsUsedInCdnMode() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.js").SetCdn("https://cdn/script1.min.js");
};
_testManifest.DefineManifest = m => m
.DefineResource("script", "Script1")
.SetUrl("script1.js")
.SetCdn("https://cdn/script1.min.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true }, "https://cdn/script1.min.js", true);
}
[Test]
public void LocalPathIsUsedInCdnModeNotSupportsSsl() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js").SetCdn("http://cdn/script1.min.js", "http://cdn/script1.js");
};
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true }, "script1.min.js", true);
}
[Test]
public void LocalDebugPathIsUsedInCdnModeNotSupportsSslAndDebug() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js").SetCdn("http://cdn/script1.min.js", "http://cdn/script1.js");
};
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true, DebugMode = true }, "script1.js", true);
VerifyPaths("script", new RequireSettings { CdnMode = true }, "https://cdn/script1.min.js");
}
[Test]
public void CdnDebugPathIsUsedInCdnModeAndDebugMode() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.js").SetCdn("http://cdn/script1.min.js", "http://cdn/script1.js");
};
_testManifest.DefineManifest = m => m
.DefineResource("script", "Script1")
.SetUrl("script1.js")
.SetCdn("http://cdn/script1.min.js", "http://cdn/script1.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true, DebugMode = true }, "http://cdn/script1.js");
}
[Test]
public void DebugPathIsUsedInCdnModeAndDebugModeAndThereIsNoCdnDebugPath() {
_testManifest.DefineManifest = m => {
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js").SetCdn("http://cdn/script1.min.js");
};
_testManifest.DefineManifest = m => m
.DefineResource("script", "Script1")
.SetUrl("script1.min.js", "script1.js")
.SetCdn("http://cdn/script1.min.js");
_resourceManager.Require("script", "Script1");
VerifyPaths("script", new RequireSettings { CdnMode = true, DebugMode = true }, "script1.js");
}

View File

@@ -29,6 +29,7 @@
<compilation targetFramework="4.8">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

View File

@@ -56,7 +56,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

View File

@@ -44,8 +44,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\lib\moq\Moq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\..\..\..\lib\nunit\nunit.framework.dll</HintPath>

View File

@@ -60,7 +60,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />