forked from Adolfi/Umbraco-v10-Unit-Testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SurfaceControllerTests.cs
40 lines (34 loc) · 1.18 KB
/
SurfaceControllerTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;
using Umbraco.Cms.Core.Cache;
using Umbraco.Cms.Core.Logging;
using Umbraco.Cms.Core.Routing;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco10Testing.Tests.Features;
namespace Umbraco10Testing.Tests
{
public class SurfaceControllerTests
{
private PageSurfaceController controller;
[SetUp]
public void SetUp()
{
this.controller = new PageSurfaceController(Mock.Of<IUmbracoContextAccessor>(), Mock.Of<IUmbracoDatabaseFactory>(), ServiceContext.CreatePartial(), AppCaches.NoCache, Mock.Of<IProfilingLogger>(), Mock.Of<IPublishedUrlProvider>());
}
[Test]
public void When_SubmitAction_ThenResultIsIsAssignableFromContentResult()
{
var result = this.controller.Submit();
Assert.IsAssignableFrom<ContentResult>(result);
}
[Test]
public void When_SubmitAction_Then_ExpectHelloWorld()
{
var result = (ContentResult)this.controller.Submit();
Assert.AreEqual("H5YR!", result.Content);
}
}
}