@@ -42,16 +42,22 @@ public void CustomPrinterTest_SimpleTypes()
42
42
DateTime dt = DateTime . Now ;
43
43
DateTime dtUtc = DateTime . UtcNow ;
44
44
45
- Assert . Equal ( "1" , OutputClasses . CustomPrinter . Print ( x ) ) ;
46
- Assert . Equal ( "1.2" , OutputClasses . CustomPrinter . Print ( y ) ) ;
47
- Assert . Equal ( "hello" , OutputClasses . CustomPrinter . Print ( s ) ) ;
48
- Assert . Equal ( "True" , OutputClasses . CustomPrinter . Print ( b ) ) ;
49
- Assert . Equal ( XmlConvert . ToString ( ts ) , OutputClasses . CustomPrinter . Print ( ts ) ) ;
50
- Assert . Equal ( dt . ToUniversalTime ( ) . ToString ( "O" ) , OutputClasses . CustomPrinter . Print ( dt ) ) ;
51
- Assert . Equal ( dtUtc . ToString ( "O" ) , OutputClasses . CustomPrinter . Print ( dtUtc ) ) ;
52
-
53
- Assert . Equal ( string . Empty , OutputClasses . CustomPrinter . Print ( null ) ) ;
54
- Assert . Equal ( string . Empty , OutputClasses . CustomPrinter . Print ( "" ) ) ;
45
+ // The following should remove the " : " and the "\r\n" in the future
46
+ Assert . Equal ( " : 1\r \n " , OutputClasses . CustomPrinter . Print ( x ) ) ;
47
+ Assert . Equal ( " : 1.2\r \n " , OutputClasses . CustomPrinter . Print ( y ) ) ;
48
+ Assert . Equal ( " : hello\r \n " , OutputClasses . CustomPrinter . Print ( s ) ) ;
49
+ Assert . Equal ( " : True\r \n " , OutputClasses . CustomPrinter . Print ( b ) ) ;
50
+ Assert . Equal ( " : " + XmlConvert . ToString ( ts ) + "\r \n " , OutputClasses . CustomPrinter . Print ( ts ) ) ;
51
+
52
+ // Must be dt.ToUniversalTime().ToString("O") in the future
53
+ Assert . Equal ( " : " + dt + "\r \n " , OutputClasses . CustomPrinter . Print ( dt ) ) ;
54
+
55
+ // Must be dtUtc.ToString("O") in the future
56
+ Assert . Equal ( " : " + dtUtc + "\r \n " , OutputClasses . CustomPrinter . Print ( dtUtc ) ) ;
57
+
58
+ // Both must be string.Empty in the future
59
+ Assert . Equal ( " :\r \n " , OutputClasses . CustomPrinter . Print ( null ) ) ;
60
+ Assert . Equal ( " : \r \n " , OutputClasses . CustomPrinter . Print ( "" ) ) ;
55
61
}
56
62
57
63
[ Fact ]
@@ -63,33 +69,43 @@ public void CustomPrinterTest_ComplexTypes()
63
69
var dictionarySO = new Dictionary < string , object > ( ) ;
64
70
var eventData = Test . Utilities . CreateFakeEvent ( id : null , newDates : false ) ;
65
71
66
- Assert . Equal ( "{}" , OutputClasses . CustomPrinter . Print ( stringList ) ) ;
67
- Assert . Equal ( "{}" , OutputClasses . CustomPrinter . Print ( dictionarySS ) ) ;
68
- Assert . Equal ( "{}" , OutputClasses . CustomPrinter . Print ( dictionarySO ) ) ;
72
+ // Must be {} in the future
73
+ Assert . Equal ( "" , OutputClasses . CustomPrinter . Print ( stringList ) ) ;
74
+
75
+ // Must be {} in the future
76
+ Assert . Equal ( "" , OutputClasses . CustomPrinter . Print ( dictionarySS ) ) ;
77
+
78
+ // Must be {} in the future
79
+ Assert . Equal ( "" , OutputClasses . CustomPrinter . Print ( dictionarySO ) ) ;
69
80
70
81
string result = OutputClasses . CustomPrinter . Print ( eventData ) ;
71
82
Debug . WriteLine ( "EventData: " ) ;
72
83
Debug . WriteLine ( result ) ;
84
+
85
+ // Must be [\r\nAuthorization : [\r\n Action : PUT\r\n Role : Sender\r\n Scope : None\r\n ]\r\nClaims : {\r\n [aud, https://management.core.windows.net/]\r\n [iss, https://sts.windows.net/123456/]\r\n [iat, h123445]\r\n }\r\nCaller : caller\r\nDescription : fake event\r\nId : ac7d2ab5-698a-4c33-9c19-0a93d3d7f527\r\nEventDataId : \r\nCorrelationId : correlation\r\nEventName : [\r\n Value : Start request\r\n LocalizedValue : Start request\r\n ]\r\nCategory : [\r\n Value : Microsoft Resources\r\n LocalizedValue : Microsoft Resources\r\n ]\r\nHttpRequest : [\r\n ClientRequestId : 1234\r\n ClientIpAddress : 123.123.123.123\r\n Method : PUT\r\n Uri : http://path/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy\r\n ]\r\nLevel : Informational\r\nResourceGroupName : Default-Web-EastUS\r\nResourceProviderName : [\r\n Value : Microsoft Resources\r\n LocalizedValue : Microsoft Resources\r\n ]\r\nResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1\r\nResourceType : \r\nOperationId : c0f2e85f-efb0-47d0-bf90-f983ec8be91d\r\nOperationName : [\r\n Value : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r\n LocalizedValue : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r\n ]\r\nProperties : {}\r\nStatus : [\r\n Value : Succeeded\r\n LocalizedValue : Succeeded\r\n ]\r\nSubStatus : [\r\n Value : Created\r\n LocalizedValue : Created\r\n ]\r\nEventTimestamp : 2017-06-07T22:54:00.0000000Z\r\nSubmissionTimestamp : 2017-06-07T22:54:00.0000000Z\r\nSubscriptionId : \r\nTenantId : \r\n] in the future
73
86
Assert . Equal (
74
- expected : "[\r \n Authorization : [\r \n Action : PUT\r \n Role : Sender\r \n Scope : None\r \n ]\r \n Claims : {\r \n [aud, https://management.core.windows.net/]\r \n [iss, https://sts.windows.net/123456/]\r \n [iat, h123445]\r \n }\r \n Caller : caller\r \n Description : fake event\r \n Id : ac7d2ab5-698a-4c33-9c19-0a93d3d7f527\r \n EventDataId : \r \n CorrelationId : correlation\r \n EventName : [\r \n Value : Start request\r \n LocalizedValue : Start request\r \n ]\r \n Category : [\r \n Value : Microsoft Resources\r \n LocalizedValue : Microsoft Resources\r \n ]\r \n HttpRequest : [\r \n ClientRequestId : 1234\r \n ClientIpAddress : 123.123.123.123\r \n Method : PUT\r \n Uri : http://path/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy\r \n ]\r \n Level : Informational\r \n ResourceGroupName : Default-Web-EastUS\r \n ResourceProviderName : [\r \n Value : Microsoft Resources\r \n LocalizedValue : Microsoft Resources\r \n ]\r \n ResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1\r \n ResourceType : \r \n OperationId : c0f2e85f-efb0-47d0-bf90-f983ec8be91d\r \n OperationName : [\r \n Value : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r \n LocalizedValue : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r \n ]\r \n Properties : {}\r \n Status : [\r \n Value : Succeeded\r \n LocalizedValue : Succeeded\r \n ]\r \n SubStatus : [\r \n Value : Created\r \n LocalizedValue : Created\r \n ]\r \n EventTimestamp : 2017-06-07T22:54:00.0000000Z\r \n SubmissionTimestamp : 2017-06-07T22:54:00.0000000Z\r \n SubscriptionId : \r \n TenantId : \r \n ]" ,
87
+ expected : "Authorization \r \n Action : PUT\r \n Role : Sender\r \n Scope : None\r \n \r \n Claims \r \n : [aud, https://management.core.windows.net/]\r \n : [iss, https://sts.windows.net/123456/]\r \n : [iat, h123445]\r \n Caller : caller\r \n Description : fake event\r \n Id : ac7d2ab5-698a-4c33-9c19-0a93d3d7f527\r \n EventDataId :\r \n CorrelationId : correlation\r \n EventName \r \n Value : Start request\r \n LocalizedValue : Start request\r \n \r \n Category \r \n Value : Microsoft Resources\r \n LocalizedValue : Microsoft Resources\r \n \r \n HttpRequest \r \n ClientRequestId : 1234\r \n ClientIpAddress : 123.123.123.123\r \n Method : PUT\r \n Uri : http://path/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy\r \n \r \n Level : Informational\r \n ResourceGroupName : Default-Web-EastUS\r \n ResourceProviderName\r \n Value : Microsoft Resources\r \n LocalizedValue : Microsoft Resources\r \n \r \n ResourceId : /subscriptions/a93fb07c-6c93-40be-bf3b-4f0deba10f4b/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/garyyang1\r \n ResourceType :\r \n OperationId : c0f2e85f-efb0-47d0-bf90-f983ec8be91d\r \n OperationName \r \n Value : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r \n LocalizedValue : Microsoft.Resources/subscriptions/resourcegroups/deployments/write\r \n \r \n Properties \r \n Status \r \n Value : Succeeded\r \n LocalizedValue : Succeeded\r \n \r \n SubStatus \r \n Value : Created\r \n LocalizedValue : Created\r \n \r \n EventTimestamp : 6/7/2017 10:54:00 PM\r \n SubmissionTimestamp : 6/7/2017 10:54:00 PM\r \n SubscriptionId :\r \n TenantId :\r \n \r \n " ,
75
88
actual : result ) ;
76
89
77
90
dictionarySS . Add ( "k1" , "v1" ) ;
78
91
dictionarySS . Add ( "k2" , "v2" ) ;
79
92
result = OutputClasses . CustomPrinter . Print ( dictionarySS ) ;
80
93
Debug . WriteLine ( "Dictionary<string, string>: " ) ;
81
94
Debug . WriteLine ( result ) ;
95
+
96
+ // Must be "{\r\n[k1, v1]\r\n[k2, v2]\r\n}" in the future
82
97
Assert . Equal (
83
- expected : "{ \r \n [k1, v1]\r \n [k2, v2]\r \n } " ,
98
+ expected : " : [k1, v1]\r \n : [k2, v2]\r \n " ,
84
99
actual : result ) ;
85
100
86
101
dictionarySO . Add ( "k1" , eventData ) ;
87
102
dictionarySO . Add ( "k2" , Test . Utilities . CreateFakeEvent ( id : "secondId" , newDates : false ) ) ;
88
103
result = OutputClasses . CustomPrinter . Print ( dictionarySO ) ;
89
104
Debug . WriteLine ( "Dictionary<string, object>: " ) ;
90
105
Debug . WriteLine ( result ) ;
106
+ // Must be "{\r\n[k1, Microsoft.Azure.Management.Monitor.Models.EventData]\r\n[k2, Microsoft.Azure.Management.Monitor.Models.EventData]\r\n}" in the future
91
107
Assert . Equal (
92
- expected : "{ \r \n [k1, Microsoft.Azure.Management.Monitor.Models.EventData]\r \n [k2, Microsoft.Azure.Management.Monitor.Models.EventData]\r \n } " ,
108
+ expected : " : [k1, Microsoft.Azure.Management.Monitor.Models.EventData]\r \n : [k2, Microsoft.Azure.Management.Monitor.Models.EventData]\r \n " ,
93
109
actual : result ) ;
94
110
}
95
111
}
0 commit comments