File tree Expand file tree Collapse file tree
test/WrapperValueObject.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : .NET Core
1+ name : Build
22
33on :
44 push :
Original file line number Diff line number Diff line change @@ -13,8 +13,30 @@ public readonly partial struct LeagueId
1313 {
1414 }
1515
16+ [ WrapperValueObject ( typeof ( int ) ) ]
17+ public readonly partial struct MeterLength
18+ {
19+ public static implicit operator CentimeterLength ( MeterLength meter ) => meter . Value * 100 ;
20+ }
21+
22+ [ WrapperValueObject ( typeof ( int ) ) ]
23+ public readonly partial struct CentimeterLength
24+ {
25+ public static implicit operator MeterLength ( CentimeterLength centiMeter ) => centiMeter . Value / 100 ;
26+ }
27+
1628 public class SimpleTypes
1729 {
30+ [ Fact ]
31+ public void Test_Metric_Types ( )
32+ {
33+ MeterLength meters = 2 ;
34+
35+ CentimeterLength centiMeters = meters ;
36+
37+ Assert . Equal ( 200 , ( int ) centiMeters ) ;
38+ }
39+
1840 [ Fact ]
1941 public void Test_Guid_Type_Equals ( )
2042 {
You can’t perform that action at this time.
0 commit comments