Skip to content

Commit f8beeec

Browse files
committed
chore: minor refactoring
1 parent fd76f50 commit f8beeec

3 files changed

Lines changed: 23 additions & 18 deletions

File tree

ObjectSemantics.NET.Tests/CognitiveMapTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public void Additional_Headers_Should_Also_Be_Mapped()
4848
{ "DateOfBirth", new DateTime(1995, 01, 01) }
4949
};
5050

51-
string generatedTemplate = "Name: {{ Name }} | Occupation: {{ Occupation }} | DOB: {{ DateOfBirth }}".Map(person, additionalParams);
52-
53-
Assert.Equal($"Name: {person.Name} | Occupation: {additionalParams["Occupation"]} | DOB: {additionalParams["DateOfBirth"]}", generatedTemplate);
51+
string generatedTemplate = "Name: {{ Name }} | Occupation: {{ Occupation }} | DOB: {{ DateOfBirth:yyyy }}".Map(person, additionalParams);
52+
string expected = "Name: John Doe | Occupation: Developer | DOB: 1995";
53+
Assert.Equal(expected, generatedTemplate);
5454
}
5555

5656

ObjectSemantics.NET.Tests/PropertyDateTimeMapTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ public class PropertyDateTimeMapTests
99
[Fact]
1010
public void Should_Map_From_Date()
1111
{
12-
DateTime date = new DateTime(2022, 11, 27, 18, 13, 59);
12+
DateTime date = new DateTime(2022, 2, 27, 18, 13, 59);
1313
Car car = new Car()
1414
{
1515
ManufactureDate = date
1616
};
1717
string result = car.Map("{{ ManufactureDate:yyyy }}|{{ ManufactureDate:yyyy-MM-dd HH:mm tt }}");
18-
Assert.Equal($"{car.ManufactureDate:yyyy}|{car.ManufactureDate:yyyy-MM-dd HH:mm tt}", result, false, true, true);
18+
string expected = "2022|2022-02-27 18:13 PM";
19+
Assert.Equal(expected, result, false, true, true);
1920
}
2021

2122
[Fact]
@@ -25,8 +26,9 @@ public void Should_Map_From_Null_Date()
2526
{
2627
LastServiceDate = null
2728
};
28-
string result = car.Map("Last serviced: {{ LastServiceDate }}");
29-
Assert.Equal($"Last serviced: {car.LastServiceDate}", result, false, true, true);
29+
string result = car.Map("Last serviced: {{ LastServiceDate:yyyy-MM-dd hh:mm tt }}");
30+
string expected = "Last serviced: ";
31+
Assert.Equal(expected, result, false, true, true);
3032
}
3133

3234
[Fact]
@@ -36,8 +38,9 @@ public void Should_Map_From_Nullable_Date()
3638
{
3739
LastServiceDate = new DateTime(2025, 1, 1)
3840
};
39-
string result = car.Map("Last serviced: {{ LastServiceDate }}");
40-
Assert.Equal($"Last serviced: {car.LastServiceDate}", result, false, true, true);
41+
string result = car.Map("Last serviced: {{ LastServiceDate:yyyy-MM-dd hh:mm tt }}");
42+
string expected = $"Last serviced: 2025-01-01 12:00 AM";
43+
Assert.Equal(expected, result, false, true, true);
4144
}
4245
}
4346
}

ObjectSemantics.NET/ObjectSemantics.NET.csproj

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
<PackageIconUrl />
1010
<RepositoryUrl>https://github.com/swagfin/ObjectSemantics.NET</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
12-
<PackageReleaseNotes>. Added support for single arrays Loop Support
13-
. Added encoding string formattings
14-
ToMD5
15-
ToBase64
16-
FromBase64
17-
. Added template extension method to allow mapping directly from Template</PackageReleaseNotes>
18-
<AssemblyVersion>7.0.0</AssemblyVersion>
19-
<FileVersion>7.0.0</FileVersion>
20-
<Version>7.0.0</Version>
12+
<PackageReleaseNotes>
13+
. Added support for single arrays Loop Support
14+
. Added encoding string formattings
15+
ToMD5
16+
ToBase64
17+
FromBase64
18+
. Added template extension method to allow mapping directly from Template
19+
</PackageReleaseNotes>
20+
<Version>7.0.1</Version>
21+
<AssemblyVersion>$(Version)</AssemblyVersion>
22+
<FileVersion>$(Version)</FileVersion>
2123
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
2224
<ApplicationIcon></ApplicationIcon>
2325
<PackageReadmeFile>README.md</PackageReadmeFile>

0 commit comments

Comments
 (0)