Skip to content

Commit 1f6d3e7

Browse files
authored
chore: Merge pull request #936 from DocSvartz/d32
Add test and Bump version to 10.0.8-pre04
2 parents 49a8748 + a0cd3c1 commit 1f6d3e7

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<!-- Properties related to build/pack -->
44
<IsPackable>false</IsPackable>
5-
<Version>10.0.8-pre03</Version>
5+
<Version>10.0.8-pre04</Version>
66
<MapsterPluginsTFMs>netstandard2.0;net10.0;net9.0;net8.0</MapsterPluginsTFMs>
77
<MapsterTFMs>netstandard2.0;net10.0;net9.0;net8.0</MapsterTFMs>
88
<MapsterEFCoreTFMs>net10.0;net9.0;net8.0</MapsterEFCoreTFMs>

src/Mapster.Tests/WhenMappingRecordRegression.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,40 @@ public void NotSelfCreationTypeMappingToSelfWithOutError()
539539
resultJ.RootElement.GetProperty("key").ToString().ShouldBe("value");
540540
}
541541

542+
/// <summary>
543+
/// https://github.com/MapsterMapper/Mapster/issues/927
544+
/// </summary>
545+
[TestMethod]
546+
public void MappingToReadOnlyInterfaceUsingIgnoreNulValuesWithoutError()
547+
{
548+
var config = new TypeAdapterConfig();
549+
config
550+
.NewConfig<IDto927, IDomain934>()
551+
.IgnoreNullValues(true);
552+
553+
Should.NotThrow(() => {
554+
555+
config.Compile();
556+
});
557+
}
558+
559+
/// <summary>
560+
/// https://github.com/MapsterMapper/Mapster/issues/927
561+
/// </summary>
562+
[TestMethod]
563+
public void MappingToReadOnlyRecordUsingIgnoreNulValuesWithoutError()
564+
{
565+
var config = new TypeAdapterConfig();
566+
config
567+
.NewConfig<IDto927, Domain927>()
568+
.IgnoreNullValues(true);
569+
570+
Should.NotThrow(() => {
571+
572+
config.Compile();
573+
});
574+
}
575+
542576
#region NowNotWorking
543577

544578
/// <summary>
@@ -993,5 +1027,26 @@ class InsiderWithCtorDestYx
9931027
public AutoCtorDestYx X { set; get; }
9941028
}
9951029

1030+
public interface IDto927
1031+
{
1032+
string Id { get; set; }
1033+
string Value { get; set; }
1034+
IList<string> ValueList { get; set; }
1035+
}
1036+
1037+
public interface IDomain934
1038+
{
1039+
string Id { get; }
1040+
string Value { get; }
1041+
IList<string> ValueList { get; }
1042+
}
1043+
1044+
public record Domain927
1045+
{
1046+
string Id { get; }
1047+
string Value { get; }
1048+
IList<string> ValueList { get; }
1049+
}
1050+
9961051
#endregion TestClasses
9971052
}

0 commit comments

Comments
 (0)