You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/ObjectMapperExtensions_Test...

27 lines
768 B

using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using System;
using Volo.Abp.AutoMapper.SampleClasses;
using Volo.Abp.ObjectMapping;
using Xunit;
namespace Volo.Abp.AutoMapper
{
public class ObjectMapperExtensions_Tests : AbpIntegratedTest<AutoMapperTestModule>
{
private readonly IObjectMapper _objectMapper;
public ObjectMapperExtensions_Tests()
{
_objectMapper = ServiceProvider.GetRequiredService<IObjectMapper>();
}
[Fact]
public void Should_Map_Objects_With_AutoMap_Attributes()
{
var dto = _objectMapper.Map(typeof(MyEntity), typeof(MyEntityDto), new MyEntity { Number = 42 });
dto.As<MyEntityDto>().Number.ShouldBe(42);
}
}
}