Skip to content

Commit

Permalink
Merge pull request #34 from darrencauthon/2point0
Browse files Browse the repository at this point in the history
Version 2.0
  • Loading branch information
darrencauthon committed May 25, 2016
2 parents 368e84e + 926f18d commit 1ac082b
Show file tree
Hide file tree
Showing 40 changed files with 27,725 additions and 18,500 deletions.
96 changes: 48 additions & 48 deletions src/AutoMoq.TestFixture.Samples/Tests/AccountControllerTests.cs
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"));
}
}
}
39 changes: 21 additions & 18 deletions src/AutoMoq.Tests/AutoMoq.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Configuration.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Interception, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Interception.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.Configuration.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity.RegistrationByConvention, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
Expand Down Expand Up @@ -100,17 +101,19 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
5 changes: 3 additions & 2 deletions src/AutoMoq.Tests/packages.config
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>
41 changes: 22 additions & 19 deletions src/AutoMoq/AutoMoq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoMoq</RootNamespace>
<AssemblyName>AutoMoq</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
Expand Down Expand Up @@ -39,20 +39,21 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Configuration.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.Configuration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Interception, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity.Interception.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.2.0\lib\20\Microsoft.Practices.Unity.Interception.Configuration.dll</HintPath>
<Reference Include="Microsoft.Practices.Unity.RegistrationByConvention, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\packages\Unity.4.0.1\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET35\Moq.dll</HintPath>
Expand Down Expand Up @@ -86,14 +87,16 @@
<Content Include="License.txt" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
8 changes: 6 additions & 2 deletions src/AutoMoq/AutoMoq.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
<package >
<metadata>
<id>AutoMoq</id>
<version>1.8.1.0</version>
<version>2.0.0.0</version>
<title>AutoMoq</title>
<authors>Darren Cauthon</authors>
<owners>Darren Cauthon</owners>
<licenseUrl>https://github.com/darrencauthon/AutoMoq/blob/master/license.txt</licenseUrl>
<projectUrl>https://github.com/darrencauthon/AutoMoq</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Auto-mocking container</description>
<releaseNotes>Added support for strict-mocking.</releaseNotes>
<releaseNotes>Upgraded Unity to 4.</releaseNotes>
<copyright>Copyright 2010-2016</copyright>
<tags>moq unity tdd testing test</tags>
<dependencies>
<dependency id="Unity" version="(4.0,)" />
<dependency id="Moq" version="(4.0,)" />
</dependencies>
</metadata>
</package>
4 changes: 2 additions & 2 deletions src/AutoMoq/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.8.1.0")]
[assembly: AssemblyFileVersion("1.8.1.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
3 changes: 2 additions & 1 deletion src/AutoMoq/packages.config
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.
Loading

0 comments on commit 1ac082b

Please sign in to comment.