Skip to content

Commit

Permalink
Revert "Try other controller tests"
Browse files Browse the repository at this point in the history
This reverts commit 93dd54c.
  • Loading branch information
cwetanow committed Mar 23, 2017
1 parent 93dd54c commit 2bd71cf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
33 changes: 24 additions & 9 deletions src/Logs.Web.Tests/Controllers/LogsControllerTests/CreateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Logs.Web.Models.Logs;
using Moq;
using NUnit.Framework;
using TestStack.FluentMVCTesting;

namespace Logs.Web.Tests.Controllers.LogsControllerTests
{
Expand All @@ -32,7 +31,25 @@ public void TestCreate_ShouldCallFactoryCreateModel()
}

[Test]
public void TestCreate_ShouldReturnCorrectViewWithModel()
public void TestCreate_ShouldReturnViewResult()
{
// Arrange
var mockedLogService = new Mock<ILogService>();
var mockedAuthenticationProvider = new Mock<IAuthenticationProvider>();
var mockedFactory = new Mock<IViewModelFactory>();

var controller = new LogsController(mockedLogService.Object, mockedAuthenticationProvider.Object,
mockedFactory.Object);

// Act
var result = controller.Create();

// Assert
Assert.IsInstanceOf<ViewResult>(result);
}

[Test]
public void TestCreate_FactoryReturnsModel_ShouldSetViewModelCorrectly()
{
// Arrange
var mockedLogService = new Mock<ILogService>();
Expand All @@ -46,13 +63,11 @@ public void TestCreate_ShouldReturnCorrectViewWithModel()
var controller = new LogsController(mockedLogService.Object, mockedAuthenticationProvider.Object,
mockedFactory.Object);

controller
.WithCallTo(c => c.Create())
.ShouldRenderDefaultView()
.WithModel<CreateLogViewModel>(m =>
{
Assert.AreSame(model, m);
});
// Act
var result = controller.Create() as ViewResult;

// Assert
Assert.AreEqual(model, result.Model);
}
}
}
4 changes: 0 additions & 4 deletions src/Logs.Web.Tests/Logs.Web.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="TestStack.FluentMVCTesting, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\TestStack.FluentMVCTesting.3.0.0\lib\NET45\TestStack.FluentMVCTesting.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\AccountControllerTests\ConstructorTests.cs" />
Expand Down
1 change: 0 additions & 1 deletion src/Logs.Web.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
<package id="NUnit3TestAdapter" version="3.7.0" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="PagedList" version="1.17.0.0" targetFramework="net452" />
<package id="TestStack.FluentMVCTesting" version="3.0.0" targetFramework="net452" />
</packages>

0 comments on commit 2bd71cf

Please sign in to comment.