@@ -55,5 +55,48 @@ public void GivenFormatAndNoVariable()
5555
5656 result . Should ( ) . Be ( @"some value: {nullvariable}" ) ;
5757 }
58+
59+ [ Test ]
60+ public void GivenFormatAndMatchingDateVariableNoDateFormat ( )
61+ {
62+ var format = "some value: {variable}" ;
63+ var values = JObject . Parse ( @"{ ""variable"": ""2024-11-28"" }" ) ;
64+ var result = DescriptionProvider . GetDescription ( format , values ) ;
65+
66+ result . Should ( ) . Be ( @"some value: 2024-11-28" ) ;
67+ }
68+
69+ [ Test ]
70+ public void GivenFormatAndMatchingDateVariableWithDateFormat ( )
71+ {
72+ var format = "some value: {variable}" ;
73+ var values = JObject . Parse ( @"{ ""variable"": ""2024-11-28"" }" ) ;
74+ var dateFormat = "dd-MMM-yyyy" ;
75+ var result = DescriptionProvider . GetDescription ( format , values , dateFormat ) ;
76+
77+ result . Should ( ) . Be ( @"some value: 28-Nov-2024" ) ;
78+ }
79+
80+ [ Test ]
81+ public void GivenFormatAndInvalidDateVariableWithDateFormat ( )
82+ {
83+ var format = "some value: {variable}" ;
84+ var values = JObject . Parse ( @"{ ""variable"": ""2024-20-28"" }" ) ;
85+ var dateFormat = "dd-MMM-yyyy" ;
86+ var result = DescriptionProvider . GetDescription ( format , values , dateFormat ) ;
87+
88+ result . Should ( ) . Be ( @"some value: 2024-20-28" ) ;
89+ }
90+
91+ [ Test ]
92+ public void GivenFormatAndIsNotDateVariableWithDateFormat ( )
93+ {
94+ var format = "some value: {variable}" ;
95+ var values = JObject . Parse ( @"{ ""variable"": ""Value"" }" ) ;
96+ var dateFormat = "dd-MMM-yyyy" ;
97+ var result = DescriptionProvider . GetDescription ( format , values , dateFormat ) ;
98+
99+ result . Should ( ) . Be ( @"some value: Value" ) ;
100+ }
58101 }
59102}
0 commit comments