Skip to content

Commit

Permalink
Split unit tests to use Collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Woodfine authored and Gary Woodfine committed Feb 5, 2018
1 parent 76c0ff5 commit 202faab
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 24 deletions.
2 changes: 2 additions & 0 deletions UnitTests/DomainObjects/ComplexDomainObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public void CustomMap(IMapperConfigurationExpression configuration)
.ForMember(dest => dest.Age, opt => opt.MapFrom(src => src.Age));
}
}


}
33 changes: 10 additions & 23 deletions UnitTests/MapperTests/ComplexDomainObjectTests.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using AutoMapper;
using DomainObjects;
using EntityObjects;
using FizzWare.NBuilder;
using Threenine.Map;
using System;
using Xunit;

namespace MapperTests
{
public class ComplexDomainObjectTests : IClassFixture<MapperFixture>, IDisposable
[Collection("Mapping")]
public class ComplexDomainObjectTests : IDisposable
{
private readonly MapperFixture fixture;
public ComplexDomainObjectTests(MapperFixture fix)
private readonly MapperFixture _mapperFixture;
public ComplexDomainObjectTests(MapperFixture fixture)
{
fixture = fix;
_mapperFixture = fixture;

}
[Fact]
Expand All @@ -25,28 +23,17 @@ public void ShouldMapComplexObject()
var testobj = Builder<ComplexDomainObject>.CreateNew().Build();
var ent = Mapper.Map<SimpleEntity>(testobj);


Assert.NotNull(ent);
Assert.IsAssignableFrom<SimpleEntity>(ent);
Assert.Equal(ent.Name, string.Concat(testobj.Firstname, " ", testobj.LastName));
Assert.Equal(ent.Description, string.Concat(testobj.Title, " ", testobj.Summary));
}

[Fact]
public void ShouldMapSimpleObject()
{

var testobj = Builder<SimpleDomainObject>.CreateNew().Build();

var ent = Mapper.Map<SimpleEntity>(testobj);

Assert.NotNull(ent);
Assert.IsAssignableFrom<SimpleEntity>(ent);
Assert.Equal(ent.Name, testobj.Name);
}


public void Dispose()
{
fixture?.Dispose();
_mapperFixture?.Dispose();
}
}
}
2 changes: 1 addition & 1 deletion UnitTests/MapperTests/MapperFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MapperFixture : IDisposable
{
public MapperFixture()
{
MapConfigurationFactory.Scan<MapperTests.MapperFixture>();
MapConfigurationFactory.Scan<MapperFixture>();
}

public void Dispose()
Expand Down
38 changes: 38 additions & 0 deletions UnitTests/MapperTests/SimpleDomainObjectTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using AutoMapper;
using DomainObjects;
using EntityObjects;
using FizzWare.NBuilder;
using System;
using Xunit;

namespace MapperTests
{
[Collection("Mapping")]
public class SimpleDomainObjectTests :IDisposable
{
private readonly MapperFixture _mapperFixture;
public SimpleDomainObjectTests(MapperFixture fixture)
{
_mapperFixture = fixture;

}

[Fact]
public void ShouldMapSimpleObject()
{
var testobj = Builder<SimpleDomainObject>.CreateNew().Build();
var ent = Mapper.Map<SimpleEntity>(testobj);

Assert.NotNull(ent);
Assert.IsAssignableFrom<SimpleEntity>(ent);
Assert.Equal(ent.Name, testobj.Name);
}



public void Dispose()
{
_mapperFixture?.Dispose();
}
}
}
12 changes: 12 additions & 0 deletions UnitTests/MapperTests/TestCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace MapperTests
{
[CollectionDefinition("Mapping")]
public class TestCollection :ICollectionFixture<MapperFixture>
{
}
}
20 changes: 20 additions & 0 deletions new 1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
+ InnerException {System.Exception: Call to Node module failed with error: Error: Cannot find module './wwwroot/dist/vendor-manifest.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (C:\code\prototype\SMS\webpack.config.js:36:27)
at createWebpackDevServer (C:\code\prototype\SMS\node_modules\aspnet-webpack\WebpackDevMiddleware.js:176:31)
at createWebpackDevServer (C:\Users\garyw\AppData\Local\Temp\tmp7A46.tmp:74:50)
at C:\Users\garyw\AppData\Local\Temp\tmp7B31.tmp:113:19
at IncomingMessage.<anonymous> (C:\Users\garyw\AppData\Local\Temp\tmp7B31.tmp:132:38)
at emitNone (events.js:86:13)
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__14`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()} System.Exception

0 comments on commit 202faab

Please sign in to comment.