Skip to content

Commit

Permalink
adding missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
garywoodfine committed Feb 5, 2018
1 parent e0c666b commit cab9bfa
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Threenine.Map
[![Build status](https://ci.appveyor.com/api/projects/status/6ob8lbutfecvi5n3/branch/master?svg=true)](https://ci.appveyor.com/project/garywoodfine/reflectmap/branch/master) [![NuGet](http://img.shields.io/nuget/v/Threenine.Data.svg)](https://www.nuget.org/packages/Threenine.Map/) [![Twitter Follow](https://img.shields.io/twitter/follow/threenine39.svg?style=social?maxAge=2592000)](https://twitter.com/threenine39)
[![Build status](https://ci.appveyor.com/api/projects/status/6ob8lbutfecvi5n3/branch/master?svg=true)](https://ci.appveyor.com/project/garywoodfine/reflectmap/branch/master) [![NuGet](http://img.shields.io/nuget/v/Threenine.Map.svg)](https://www.nuget.org/packages/Threenine.Map/) [![Twitter Follow](https://img.shields.io/twitter/follow/threenine39.svg?style=social?maxAge=2592000)](https://twitter.com/threenine39)


Handy utility library to help with the implementation of AutoMapper in software projects.
Expand Down
52 changes: 52 additions & 0 deletions UnitTests/MapperTests/ComplexDomainObjectTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using DomainObjects;
using EntityObjects;
using FizzWare.NBuilder;
using Threenine.Map;
using Xunit;

namespace MapperTests
{
public class ComplexDomainObjectTests : IClassFixture<MapperFixture>, IDisposable
{
private readonly MapperFixture fixture;
public ComplexDomainObjectTests(MapperFixture fix)
{
fixture = fix;

}
[Fact]
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();
}
}
}
24 changes: 24 additions & 0 deletions UnitTests/MapperTests/MapperFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using AutoMapper;
using Threenine.Map;
using Xunit;

namespace MapperTests
{
public class MapperFixture : IDisposable
{
public MapperFixture()
{
MapConfigurationFactory.Scan<MapperTests.MapperFixture>();
}

public void Dispose()
{

// Do "global" teardown here; Only called once.
}
}

}

0 comments on commit cab9bfa

Please sign in to comment.