-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from darrencauthon/2point0
Version 2.0
- Loading branch information
Showing
40 changed files
with
27,725 additions
and
18,500 deletions.
There are no files selected for viewing
96 changes: 48 additions & 48 deletions
96
src/AutoMoq.TestFixture.Samples/Tests/AccountControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Web.Mvc; | ||
using AutoMoq.Helpers; | ||
using AutoMoq.TestFixture.Samples.Code; | ||
using Moq; | ||
using NUnit.Framework; | ||
|
||
namespace AutoMoq.TestFixture.Samples.Tests | ||
{ | ||
[TestFixture] | ||
public class AccountControllerTests : AutoMoqTestFixture<AccountController> | ||
{ | ||
[SetUp] | ||
public void BeforeEachTest() | ||
{ | ||
ResetSubject(); | ||
} | ||
|
||
[Test] | ||
public void ShouldListAllAccountsFromRepository() | ||
{ | ||
Mocked<IAccountRepository>().Setup( | ||
x => x.Find()).Returns( | ||
new[] {new Account(), new Account()}); | ||
|
||
ViewResult result = Subject.ListAllAccounts() as ViewResult; | ||
|
||
var model = result.ViewData.Model as IEnumerable<Account>; | ||
|
||
Assert.That(model.Count(), Is.EqualTo(2)); | ||
|
||
Mocked<IAccountRepository>() | ||
.Verify(x => x.SomethingElse(), Times.Once()); | ||
} | ||
|
||
[Test] | ||
public void ShouldShowTheErrorPageWhenRepositoryHasErrors() | ||
{ | ||
Mocked<IAccountRepository>().Setup( | ||
x => x.Find()).Throws(new Exception()); | ||
|
||
ViewResult result = Subject.ListAllAccounts() as ViewResult; | ||
|
||
Assert.That(result.ViewName, Is.EqualTo("Error")); | ||
} | ||
} | ||
} | ||
using AutoMoq.TestFixture.Samples.Code; | ||
using Moq; | ||
using NUnit.Framework; | ||
|
||
namespace AutoMoq.TestFixture.Samples.Tests | ||
{ | ||
[TestFixture] | ||
public class AccountControllerTests : AutoMoqTestFixture<AccountController> | ||
{ | ||
[SetUp] | ||
public void BeforeEachTest() | ||
{ | ||
ResetSubject(); | ||
} | ||
|
||
[Test] | ||
public void ShouldListAllAccountsFromRepository() | ||
{ | ||
Mocked<IAccountRepository>().Setup( | ||
x => x.Find()).Returns( | ||
new[] {new Account(), new Account()}); | ||
|
||
ViewResult result = Subject.ListAllAccounts() as ViewResult; | ||
|
||
var model = result.ViewData.Model as IEnumerable<Account>; | ||
|
||
Assert.That(model.Count(), Is.EqualTo(2)); | ||
|
||
Mocked<IAccountRepository>() | ||
.Verify(x => x.SomethingElse(), Times.Once()); | ||
} | ||
|
||
[Test] | ||
public void ShouldShowTheErrorPageWhenRepositoryHasErrors() | ||
{ | ||
Mocked<IAccountRepository>().Setup( | ||
x => x.Find()).Throws(new Exception()); | ||
|
||
ViewResult result = Subject.ListAllAccounts() as ViewResult; | ||
|
||
Assert.That(result.ViewName, Is.EqualTo("Error")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Unity" version="2.0" requireReinstallation="true" /> | ||
<package id="NUnit" version="2.5.9.10348" /> | ||
<package id="CommonServiceLocator" version="1.3" targetFramework="net45" /> | ||
<package id="Moq" version="4.0.10827" requireReinstallation="true" /> | ||
<package id="NUnit" version="2.5.9.10348" /> | ||
<package id="Should" version="1.1.12.0" /> | ||
<package id="Unity" version="4.0.1" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="CommonServiceLocator" version="1.3" targetFramework="net45" /> | ||
<package id="Moq" version="4.0.10827" requireReinstallation="true" /> | ||
<package id="Unity" version="2.0" requireReinstallation="true" /> | ||
<package id="Unity" version="4.0.1" targetFramework="net45" /> | ||
</packages> |
Binary file not shown.
Oops, something went wrong.