Skip to content

Commit

Permalink
👻 Test adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian committed Jun 28, 2016
1 parent 28add9c commit 0f1396f
Show file tree
Hide file tree
Showing 23 changed files with 109 additions and 126 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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>8df1975f-8278-4fc7-afc0-719d2a801bf6</ProjectGuid>
<RootNamespace>Idea.Repository.EntityFrameworkCore.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
<ProjectExtensions>
<VisualStudio>
<UserProperties __JSONSchema="http://json.schemastore.org/project-1.0.0-rc2" />
</VisualStudio>
</ProjectExtensions>
</Project>
5 changes: 2 additions & 3 deletions Idea.Repository.EntityFramework.Tests/Mocks/Hero.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using Idea.Entity;

using Idea7.Entity;

namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public class Hero : Entity<string>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;

namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public class HeroDbContext : DbContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Idea7.UnitOfWork.EntityFramework;

using Idea.UnitOfWork.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public class HeroDbContextFactory : IDbContextFactory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Idea7.Entity;
using Idea.Entity;

namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public class HeroRelationship : Entity<string>
{
Expand Down
4 changes: 2 additions & 2 deletions Idea.Repository.EntityFramework.Tests/Mocks/HeroRepository.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Idea7.UnitOfWork;
using Idea.UnitOfWork;

namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public class HeroRepository : Repository<Hero, string>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Idea7.Repository.EntityFramework.Tests.Mocks
namespace Idea.Repository.EntityFrameworkCore.Tests.Mocks
{
public enum Relationship
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Idea7.Repository.EntityFramework.Tests")]
[assembly: AssemblyTitle("Idea.Repository.EntityFrameworkCore.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Idea7.Repository.EntityFramework.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyProduct("Idea.Repository.EntityFrameworkCore.Tests")]
[assembly: AssemblyCopyright("Copyright © Sebastian Bušek 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
10 changes: 4 additions & 6 deletions Idea.Repository.EntityFramework.Tests/RepositoryFixture.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;

using Idea7.Repository.EntityFramework.Tests.Mocks;
using Idea7.UnitOfWork;
using Idea7.UnitOfWork.EntityFramework;

using Idea.Repository.EntityFrameworkCore.Tests.Mocks;
using Idea.UnitOfWork;
using Idea.UnitOfWork.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Idea7.Repository.EntityFramework.Tests
namespace Idea.Repository.EntityFrameworkCore.Tests
{
public class RepositoryFixture : IDisposable
{
Expand Down
40 changes: 19 additions & 21 deletions Idea.Repository.EntityFramework.Tests/RepositoryTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System;

using Idea7.Repository.EntityFramework.Tests.Mocks;

using Idea.Repository.EntityFrameworkCore.Tests.Mocks;
using Xunit;

namespace Idea7.Repository.EntityFramework.Tests
namespace Idea.Repository.EntityFrameworkCore.Tests
{
public class RepositoryTests : IClassFixture<RepositoryFixture>
{
Expand Down Expand Up @@ -37,7 +35,7 @@ public void CreateNewInstance_ShouldSuccess()
public void FindBatman_ShouldSuccess()
{
Hero batman;
using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
batman = repository.Find(BatmanKey);
Expand All @@ -51,7 +49,7 @@ public void FindBatman_ShouldSuccess()
public void FindCyborg_ShouldFoundNothing()
{
Hero cyborg;
using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
cyborg = repository.Find(FlashKey);
Expand All @@ -70,7 +68,7 @@ public void CreateHero_ShouldSuccess()
RealName = "Victor Stone",
Origin = "Detroit"
};
using (var uow = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
repository.Create(cyborg);
Expand All @@ -80,7 +78,7 @@ public void CreateHero_ShouldSuccess()

cyborg = null;

using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
cyborg = repository.Find(CyborgKey);
Expand All @@ -101,9 +99,9 @@ public void Create_CreateHeroInCommitedUow_InsideNotCommitedUow_ShouldNotStoreDa
Origin = "Atlantis"
};

using (var uow = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
using (var uow2 = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow2 = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
repository.Create(aquaman);
Expand All @@ -113,10 +111,10 @@ public void Create_CreateHeroInCommitedUow_InsideNotCommitedUow_ShouldNotStoreDa
}

aquaman = null;
using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
aquaman = repository.Find(WonderWomanKey);
aquaman = repository.Find(AquamanKey);
}

Assert.Null(aquaman);
Expand All @@ -133,9 +131,9 @@ public void Create_CreateHeroInNotCommitedUow_InsideCommitedUow_ShouldNotStoreDa
Origin = "Unknown"
};

using (var uow = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
using (var uow2 = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow2 = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
repository.Create(greenLantern);
Expand All @@ -145,7 +143,7 @@ public void Create_CreateHeroInNotCommitedUow_InsideCommitedUow_ShouldNotStoreDa
}

greenLantern = null;
using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
greenLantern = repository.Find(WonderWomanKey);
Expand All @@ -155,7 +153,7 @@ public void Create_CreateHeroInNotCommitedUow_InsideCommitedUow_ShouldNotStoreDa
}

[Fact]
public void Create_CreateHeroInCommitedUow_InsideCommitedUow_ShouldNotStoreData()
public void Create_CreateHeroInCommitedUow_InsideCommitedUow_ShouldStoreData()
{
var ww = new Hero
{
Expand All @@ -165,9 +163,9 @@ public void Create_CreateHeroInCommitedUow_InsideCommitedUow_ShouldNotStoreData(
Origin = "Themyscira"
};

using (var uow = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
using (var uow2 = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow2 = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
repository.Create(ww);
Expand All @@ -179,7 +177,7 @@ public void Create_CreateHeroInCommitedUow_InsideCommitedUow_ShouldNotStoreData(
}

ww = null;
using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
ww = repository.Find(WonderWomanKey);
Expand All @@ -199,15 +197,15 @@ public void CreateHero_NotCommitedShouldFoundNothing()
RealName = "Victor Stone",
Origin = "Detroit"
};
using (var uow = new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (var uow = new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
repository.Create(cyborg);
}

cyborg = null;

using (new UnitOfWork.EntityFramework.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
using (new UnitOfWork.EntityFrameworkCore.UnitOfWork(_fixture.DbContextFactory, _fixture.UowManager))
{
var repository = new HeroRepository(_fixture.UowManager);
cyborg = repository.Find(CyborgKey);
Expand Down
12 changes: 6 additions & 6 deletions Idea.Repository.EntityFramework.Tests/project.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "1.0.0-*",
"description": "Idea7.Repository.EntityFramework.Tests Class Library",
"description": "Idea.Repository.EntityFrameworkCore.Tests Class Library",
"authors": [ "Sebastian Bušek" ],
"packOptions": {
"tags": [ "Unit of work", "UoW", "Entity Framework Core", "Tests", "xUnit" ],
Expand All @@ -17,11 +17,11 @@
"NETStandard.Library": "1.5.0-rc2-24027",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-*",
"Idea7.Entity": "1.0.0-*",
"Idea7.UnitOfWork.EntityFramework": "1.0.0-*",
"Idea7.UnitOfWork": "1.0.0-*",
"Idea7.Repository.EntityFramework": "1.0.0-*",
"Idea7.Repository": "1.0.0-*",
"Idea.Entity": "1.0.0-*",
"Idea.UnitOfWork.EntityFrameworkCore": "1.0.0-*",
"Idea.UnitOfWork": "1.0.0-*",
"Idea.Repository.EntityFrameworkCore": "1.0.0-*",
"Idea.Repository": "1.0.0-*",
"Microsoft.EntityFrameworkCore.InMemory": "1.0.0-rc2-final"
},

Expand Down
2 changes: 1 addition & 1 deletion Idea.Repository.EntityFramework6/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void ResolveUnitOfWork()
return;
}

var uow = _manager.Current() as UnitOfWork.EntityFramework6.UnitOfWork;
var uow = _manager.Current() as Idea.UnitOfWork.EntityFramework6.UnitOfWork;
if (uow == null)
{
throw new Exception("Unable to resolve Entity Framework Unit of work");
Expand Down

This file was deleted.

23 changes: 0 additions & 23 deletions Idea.UnitOfWork.EntityFramework.Tests/Properties/AssemblyInfo.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Idea.UnitOfWork.EntityFramework.Tests/project.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<HintPath>..\packages\Idea.Entity.1.0.0\lib\netstandard1.2\Idea.Entity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Idea.Query, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Idea.Query.1.0.0\lib\netstandard1.2\Idea.Query.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Idea.UnitOfWork, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Idea.UnitOfWork.1.0.0\lib\netstandard1.2\Idea.UnitOfWork.dll</HintPath>
<Private>True</Private>
Expand Down
1 change: 1 addition & 0 deletions Idea.UnitOfWork.EntityFramework6/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
<package id="Idea.Entity" version="1.0.0" targetFramework="net452" />
<package id="Idea.Query" version="1.0.0" targetFramework="net452" />
<package id="Idea.UnitOfWork" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="net452" />
<package id="NETStandard.Library" version="1.6.0" targetFramework="net452" />
Expand Down
Loading

0 comments on commit 0f1396f

Please sign in to comment.