Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/AutoMapper/AutoMapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
</ItemGroup>

<Target Name="PreBuild" AfterTargets="GetAssemblyVersion">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(ProjectDir)\PreBuild.ps1&quot; -version $(Version)" />
<Exec Condition=" '$(OS)' == 'Windows_NT' " Command="powershell -ExecutionPolicy Unrestricted -File &quot;$(ProjectDir)\PreBuild.ps1&quot; -version $(Version)" />
<Exec Condition=" '$(OS)' != 'Windows_NT' " Command="&quot;$(ProjectDir)PreBuild.sh&quot; $(Version)" />
</Target>

</Project>
15 changes: 15 additions & 0 deletions src/AutoMapper/PreBuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
version=$1
echo $version
readarray -d . -t versionNumbers <<< $version
if [[ ${versionNumbers[1]} -eq "0" && ${versionNumbers[2]} -eq "0" ]]
then
oldVersion=$(({versionNumbers[0]} - 1))
else
oldVersion=${versionNumbers[0]}
fi
oldVersion="$oldVersion.0.0"
echo $oldVersion
rm -rf ../LastMajorVersionBinary
curl https://globalcdn.nuget.org/packages/automapper.$oldVersion.nupkg --create-dirs -o ../LastMajorVersionBinary/automapper.$oldVersion.nupkg
unzip -j ../LastMajorVersionBinary/automapper.$oldVersion.nupkg lib/netstandard2.1/AutoMapper.dll -d ../LastMajorVersionBinary
8 changes: 4 additions & 4 deletions src/UnitTests/Internationalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class Order

public class Customer
{
public string ��� { get; set; }
public string Æøå { get; set; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The encoding was wrong on these characters. They were encoded in "Western European (Windows)", but the file is encoded in UTF-8. I can only guess that on Windows, some kind of encoding munging is done to allow it pass through the compiler, but on Linux no such "convenience" is present, so compilation was failing.

}

public class OrderDto
{
public string Customer��� { get; set; }
public string CustomerÆøå { get; set; }
}

protected override MapperConfiguration CreateConfiguration() => new(cfg =>
Expand All @@ -31,13 +31,13 @@ public class OrderDto

protected override void Because_of()
{
_result = Mapper.Map<Order, OrderDto>(new Order {Customer = new Customer {��� = "Bob"}});
_result = Mapper.Map<Order, OrderDto>(new Order {Customer = new Customer {Æøå = "Bob"}});
}

[Fact]
public void Should_match_to_identical_property_name_on_destination()
{
_result.Customer���.ShouldBe("Bob");
_result.CustomerÆøå.ShouldBe("Bob");
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/UnitTests/Tests/TypeMapFactorySpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class When_using_a_source_member_name_replacer : SpecBase
public class Source
{
public int Value { get; set; }
public int �v�ator { get; set; }
public int Ävíator { get; set; }
public int SubAirlinaFlight { get; set; }
}

Expand All @@ -187,14 +187,14 @@ public void Should_map_properties_with_different_names()
{
var config = new MapperConfiguration(cfg =>
{
cfg.ReplaceMemberName("A", "");
cfg.ReplaceMemberName("i", "");
cfg.ReplaceMemberName("A", "Ä");
cfg.ReplaceMemberName("i", "í");
cfg.ReplaceMemberName("Airline", "Airlina");
cfg.CreateMap<Source, Destination>();
});

var mapper = config.CreateMapper();
var dest = mapper.Map<Destination>(new Source {�v�ator = 3, SubAirlinaFlight = 4, Value = 5});
var dest = mapper.Map<Destination>(new Source {Ävíator = 3, SubAirlinaFlight = 4, Value = 5});
dest.Aviator.ShouldBe(3);
dest.SubAirlineFlight.ShouldBe(4);
dest.Value.ShouldBe(5);
Expand All @@ -206,7 +206,7 @@ public class When_using_a_source_member_name_replacer_with_profile : SpecBase
public class Source
{
public int Value { get; set; }
public int �v�ator { get; set; }
public int Ävíator { get; set; }
public int SubAirlinaFlight { get; set; }
}

Expand All @@ -230,14 +230,14 @@ public void Should_map_properties_with_different_names()
{
var config = new MapperConfiguration(cfg =>
{
cfg.ReplaceMemberName("A", "");
cfg.ReplaceMemberName("i", "");
cfg.ReplaceMemberName("A", "Ä");
cfg.ReplaceMemberName("i", "í");
cfg.ReplaceMemberName("Airline", "Airlina");
cfg.AddProfile<TestProfile>();
});

var mapper = config.CreateMapper();
var dest = mapper.Map<Destination>(new Source { �v�ator = 3, SubAirlinaFlight = 4, Value = 5 });
var dest = mapper.Map<Destination>(new Source { Ävíator = 3, SubAirlinaFlight = 4, Value = 5 });
dest.Aviator.ShouldBe(3);
dest.SubAirlineFlight.ShouldBe(4);
dest.Value.ShouldBe(5);
Expand Down