Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dotnetcore #36

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src_dotnetcore/AutoMoq/.vs/restore.dg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#:C:\Users\cauthond\Desktop\AutoMoq\src_dotnetcore\AutoMoq\src\AutoMoq.Tests\AutoMoq.Tests.xproj
C:\Users\cauthond\Desktop\AutoMoq\src_dotnetcore\AutoMoq\src\AutoMoq.Tests\AutoMoq.Tests.xproj|C:\Users\cauthond\Desktop\AutoMoq\src_dotnetcore\AutoMoq\src\AutoMoq\AutoMoq.xproj
39 changes: 39 additions & 0 deletions src_dotnetcore/AutoMoq/AutoMoq.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0AAE96A3-235C-409B-8CE1-1123B04DBCB9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4F0AA1D-0D72-4DCE-95B1-EBD12586F99D}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoMoq", "src\AutoMoq\AutoMoq.xproj", "{D0DDFA4C-33D7-436A-9F41-F14489D5F973}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoMoq.Tests", "src\AutoMoq.Tests\AutoMoq.Tests.xproj", "{B3A9EA6F-1D21-4974-90F8-D912A5A174C7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D0DDFA4C-33D7-436A-9F41-F14489D5F973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0DDFA4C-33D7-436A-9F41-F14489D5F973}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0DDFA4C-33D7-436A-9F41-F14489D5F973}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0DDFA4C-33D7-436A-9F41-F14489D5F973}.Release|Any CPU.Build.0 = Release|Any CPU
{B3A9EA6F-1D21-4974-90F8-D912A5A174C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3A9EA6F-1D21-4974-90F8-D912A5A174C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3A9EA6F-1D21-4974-90F8-D912A5A174C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3A9EA6F-1D21-4974-90F8-D912A5A174C7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D0DDFA4C-33D7-436A-9F41-F14489D5F973} = {0AAE96A3-235C-409B-8CE1-1123B04DBCB9}
{B3A9EA6F-1D21-4974-90F8-D912A5A174C7} = {0AAE96A3-235C-409B-8CE1-1123B04DBCB9}
EndGlobalSection
EndGlobal
7 changes: 7 additions & 0 deletions src_dotnetcore/AutoMoq/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
6 changes: 6 additions & 0 deletions src_dotnetcore/AutoMoq/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
21 changes: 21 additions & 0 deletions src_dotnetcore/AutoMoq/src/AutoMoq.Tests/AutoMoq.Tests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>b3a9ea6f-1d21-4974-90f8-d912a5a174c7</ProjectGuid>
<RootNamespace>AutoMoq.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
69 changes: 69 additions & 0 deletions src_dotnetcore/AutoMoq/src/AutoMoq.Tests/AutoMoqListTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//using System;
//using AutoMoq.Helpers;
//using Microsoft.Practices.Unity;
//using Moq;
//using NUnit.Framework;
//using System.Collections.Generic;
//using System.Linq;
//using Should;

//namespace AutoMoq.Tests
//{
// [TestFixture]
// public class AutoMoqListTests
// {
// private AutoMoqer mocker;

// [SetUp]
// public void Setup()
// {
// mocker = new AutoMoqer();
// }

// [Test]
// public void Can_register_and_resolve_a_list_using_the_declared_type()
// {
// var dependency = new Dependency();
// IList<Dependency> list = new List<Dependency>();
// list.Add(dependency);

// mocker.SetInstance(list);
// var thing = mocker.Create<ThingThatHasDependencies>();

// thing.FindOne().ShouldBeSameAs(dependency);
// }

// [Test]
// public void Can_register_and_resolve_a_list_with_an_explicit_type_provided_to_SetInstance()
// {
// var dependency = new Dependency();
// var list = new List<Dependency>();
// list.Add(dependency);

// mocker.SetInstance<IList<Dependency>>(list);
// var thing = mocker.Create<ThingThatHasDependencies>();

// thing.FindOne().ShouldBeSameAs(dependency);
// }
// }

// public class Dependency
// {
// }

// public class ThingThatHasDependencies {
// private IList<Dependency> innerList;

// public ThingThatHasDependencies(IList<Dependency> dependencies) {
// innerList = dependencies;
// }

// public Dependency FindOne() {
// if(innerList == null || innerList.Any() == false) {
// return null;
// }

// return innerList.FirstOrDefault();
// }
// }
//}
120 changes: 120 additions & 0 deletions src_dotnetcore/AutoMoq/src/AutoMoq.Tests/AutoMoqTestFixtureTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
//using System;
//using AutoMoq.Helpers;
//using Microsoft.Practices.Unity;
//using Moq;
//using NUnit.Framework;
//using Should;

//namespace AutoMoq.Tests
//{
// [TestFixture]
// public class AutoMoqTestFixtureTests
// {
// [Test]
// public void Subject_should_be_populated_after_construction()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// Assert.That( fixture.Subject, Is.Not.Null);
// }

// [Test]
// public void Dependencies_should_be_accessible()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// IDependency dependency = fixture.Dependency<IDependency>();

// Assert.That( dependency, Is.Not.Null );
// }

// [Test]
// public void Mocked_dependencies_should_be_accessible()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// Mock<IDependency> disp = fixture.Mocked<IDependency>();

// Assert.That(disp, Is.Not.Null);
// }

// [Test]
// public void ResetSubject_should_give_another_instance_of_type()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// ClassWithDependencies instance1 = fixture.Subject;

// fixture.ResetSubject();

// ClassWithDependencies instance2 = fixture.Subject;

// Assert.AreNotSame(instance1,instance2);
// }

// [Test]
// public void ResetSubject_should_have_different_mock_dependencies()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// var origDependency = fixture.Mocked<IDependency>();

// fixture.ResetSubject();

// Assert.AreNotSame(origDependency, fixture.Mocked<IDependency>());
// }

// [Test]
// public void ResetSubject_should_allow_a_different_config_to_be_passed()
// {
// var fixture = new AutoMoqTestFixture<Apple>();

// var looseConfig = new Config {MockBehavior = MockBehavior.Loose};
// fixture.ResetSubject(looseConfig);

// fixture.Subject.DoSomething(); // expecting no error

// var strictConfig = new Config {MockBehavior = MockBehavior.Strict};
// fixture.ResetSubject(strictConfig);

// var errorHit = false;
// try
// {
// fixture.Subject.DoSomething(); // expecting an error
// }
// catch
// {
// errorHit = true;
// }
// errorHit.ShouldBeTrue();
// }

// [Test]
// public void Mocker_should_be_set()
// {
// var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

// Assert.IsNotNull(fixture.Mocker);
// }

// public class Apple
// {
// private readonly IOrange orange;

// public Apple(IOrange orange)
// {
// this.orange = orange;
// }

// public void DoSomething()
// {
// orange.Something();
// }
// }

// public interface IOrange
// {
// void Something();
// }
// }
//}
Loading