Correcting a few unit tests after conditions have changed.

This commit is contained in:
Morten Christensen
2012-11-23 08:35:58 -01:00
parent 99820bf5e1
commit c7693386a2
7 changed files with 24 additions and 6 deletions

View File

@@ -92,7 +92,6 @@ namespace Umbraco.Tests.Routing
[TestCase(1178, "/home/sub1/custom-sub-2")]
[TestCase(1175, "/home/sub-2")]
[TestCase(1172, "/test-page")]
public void Get_Nice_Url_Not_Hiding_Top_Level(int nodeId, string niceUrlMatch)
{
var routingContext = GetRoutingContext("/test", 1111);
@@ -116,7 +115,6 @@ namespace Umbraco.Tests.Routing
[TestCase(1178, "/sub1/custom-sub-2")]
[TestCase(1175, "/sub-2")]
[TestCase(1172, "/test-page")] // not hidden because not first root
public void Get_Nice_Url_Hiding_Top_Level(int nodeId, string niceUrlMatch)
{
var routingContext = GetRoutingContext("/test", 1111);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
@@ -233,8 +234,14 @@ namespace Umbraco.Tests.Services
{
// Arrange
var contentService = ServiceContext.ContentService;
var root = contentService.GetById(1046);
contentService.SaveAndPublish(root);
var content = contentService.GetById(1048);
content.ExpireDate = DateTime.UtcNow.AddSeconds(1);
contentService.SaveAndPublish(content);
// Act
Thread.Sleep(new TimeSpan(0, 0, 0, 2));
var contents = contentService.GetContentForExpiration();
// Assert
@@ -334,7 +341,6 @@ namespace Umbraco.Tests.Services
Assert.That(published, Is.True);
Assert.That(contents.First(x => x.Id == 1046).Published, Is.True);//No restrictions, so should be published
Assert.That(contents.First(x => x.Id == 1047).Published, Is.True);//Released 5 mins ago, so should be published
Assert.That(contents.First(x => x.Id == 1048).Published, Is.False);//Expired 5 mins ago, so shouldn't be published
Assert.That(contents.First(x => x.Id == 1049).Published, Is.False);//Trashed content, so shouldn't be published
}
@@ -394,7 +400,6 @@ namespace Umbraco.Tests.Services
Assert.That(published, Is.True);//Nothing was cancelled, so should be true
Assert.That(content.Published, Is.True);//No restrictions, so should be published
Assert.That(children.First(x => x.Id == 1047).Published, Is.True);//Released 5 mins ago, so should be published
Assert.That(children.First(x => x.Id == 1048).Published, Is.False);//Expired 5 mins ago, so shouldn't be published
}
[Test]
@@ -403,6 +408,8 @@ namespace Umbraco.Tests.Services
// Arrange
var contentService = ServiceContext.ContentService;
var content = contentService.GetById(1048); //This Content expired 5min ago
content.ExpireDate = DateTime.UtcNow.AddMinutes(-5);
contentService.Save(content);
var parent = contentService.GetById(1046);
bool parentPublished = contentService.Publish(parent, 0);//Publish root Home node to enable publishing of '1048'
@@ -715,8 +722,6 @@ namespace Umbraco.Tests.Services
//Create and Save Content "Text Page 1" based on "umbTextpage" -> 1048
Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", textpage.Id);
subpage2.ExpireDate = DateTime.UtcNow.AddMinutes(-5);
subpage2.ChangePublishedState(true);
ServiceContext.ContentService.Save(subpage2, 0);
//Create and Save Content "Text Page Deleted" based on "umbTextpage" -> 1049

View File

@@ -38,6 +38,8 @@
<OldToolsVersion>4.0</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
@@ -2187,4 +2189,5 @@ xcopy /s /y "$(ProjectDir)umbraco.presentation\*.master" "$(ProjectDir)..\Umbrac
<PropertyGroup>
<!--<PostBuildEvent>xcopy "$(ProjectDir)..\..\lib\*.dll" "$(TargetDir)*.dll" /Y</PostBuildEvent>-->
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>

View File

@@ -53,6 +53,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -447,4 +449,5 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>

View File

@@ -40,6 +40,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -161,6 +163,7 @@
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.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">

View File

@@ -53,6 +53,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -492,4 +494,5 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>

View File

@@ -53,6 +53,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -224,4 +226,5 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>