@@ -10,214 +10,162 @@ public class OAuthExceptionTest
1010 [ TestMethod ]
1111 public void OAuthException_DefaultConstructor_ShouldUseDefaultMessage ( )
1212 {
13- // Act
14- var exception = new OAuthException ( ) ;
1513
16- // Assert
14+ var exception = new OAuthException ( ) ;
1715 Assert . AreEqual ( "OAuth operation failed." , exception . Message ) ;
1816 Assert . IsNull ( exception . InnerException ) ;
1917 }
2018
2119 [ TestMethod ]
2220 public void OAuthException_WithMessage_ShouldUseProvidedMessage ( )
2321 {
24- // Arrange
22+
2523 var message = "Custom OAuth error message" ;
26-
27- // Act
2824 var exception = new OAuthException ( message ) ;
29-
30- // Assert
3125 Assert . AreEqual ( message , exception . Message ) ;
3226 Assert . IsNull ( exception . InnerException ) ;
3327 }
3428
3529 [ TestMethod ]
3630 public void OAuthException_WithMessageAndInnerException_ShouldUseBoth ( )
3731 {
38- // Arrange
32+
3933 var message = "Custom OAuth error message" ;
4034 var innerException = new InvalidOperationException ( "Inner exception" ) ;
41-
42- // Act
4335 var exception = new OAuthException ( message , innerException ) ;
44-
45- // Assert
4636 Assert . AreEqual ( message , exception . Message ) ;
4737 Assert . AreEqual ( innerException , exception . InnerException ) ;
4838 }
4939
5040 [ TestMethod ]
5141 public void OAuthConfigurationException_DefaultConstructor_ShouldUseDefaultMessage ( )
5242 {
53- // Act
54- var exception = new OAuthConfigurationException ( ) ;
5543
56- // Assert
44+ var exception = new OAuthConfigurationException ( ) ;
5745 Assert . AreEqual ( "OAuth configuration is invalid." , exception . Message ) ;
5846 Assert . IsNull ( exception . InnerException ) ;
5947 }
6048
6149 [ TestMethod ]
6250 public void OAuthConfigurationException_WithMessage_ShouldUseProvidedMessage ( )
6351 {
64- // Arrange
52+
6553 var message = "Custom configuration error message" ;
66-
67- // Act
6854 var exception = new OAuthConfigurationException ( message ) ;
69-
70- // Assert
7155 Assert . AreEqual ( message , exception . Message ) ;
7256 Assert . IsNull ( exception . InnerException ) ;
7357 }
7458
7559 [ TestMethod ]
7660 public void OAuthConfigurationException_WithMessageAndInnerException_ShouldUseBoth ( )
7761 {
78- // Arrange
62+
7963 var message = "Custom configuration error message" ;
8064 var innerException = new ArgumentException ( "Inner exception" ) ;
81-
82- // Act
8365 var exception = new OAuthConfigurationException ( message , innerException ) ;
84-
85- // Assert
8666 Assert . AreEqual ( message , exception . Message ) ;
8767 Assert . AreEqual ( innerException , exception . InnerException ) ;
8868 }
8969
9070 [ TestMethod ]
9171 public void OAuthTokenException_DefaultConstructor_ShouldUseDefaultMessage ( )
9272 {
93- // Act
94- var exception = new OAuthTokenException ( ) ;
9573
96- // Assert
74+ var exception = new OAuthTokenException ( ) ;
9775 Assert . AreEqual ( "OAuth token operation failed." , exception . Message ) ;
9876 Assert . IsNull ( exception . InnerException ) ;
9977 }
10078
10179 [ TestMethod ]
10280 public void OAuthTokenException_WithMessage_ShouldUseProvidedMessage ( )
10381 {
104- // Arrange
82+
10583 var message = "Custom token error message" ;
106-
107- // Act
10884 var exception = new OAuthTokenException ( message ) ;
109-
110- // Assert
11185 Assert . AreEqual ( message , exception . Message ) ;
11286 Assert . IsNull ( exception . InnerException ) ;
11387 }
11488
11589 [ TestMethod ]
11690 public void OAuthTokenException_WithMessageAndInnerException_ShouldUseBoth ( )
11791 {
118- // Arrange
92+
11993 var message = "Custom token error message" ;
12094 var innerException = new InvalidOperationException ( "Inner exception" ) ;
121-
122- // Act
12395 var exception = new OAuthTokenException ( message , innerException ) ;
124-
125- // Assert
12696 Assert . AreEqual ( message , exception . Message ) ;
12797 Assert . AreEqual ( innerException , exception . InnerException ) ;
12898 }
12999
130100 [ TestMethod ]
131101 public void OAuthAuthorizationException_DefaultConstructor_ShouldUseDefaultMessage ( )
132102 {
133- // Act
134- var exception = new OAuthAuthorizationException ( ) ;
135103
136- // Assert
104+ var exception = new OAuthAuthorizationException ( ) ;
137105 Assert . AreEqual ( "OAuth authorization failed." , exception . Message ) ;
138106 Assert . IsNull ( exception . InnerException ) ;
139107 }
140108
141109 [ TestMethod ]
142110 public void OAuthAuthorizationException_WithMessage_ShouldUseProvidedMessage ( )
143111 {
144- // Arrange
112+
145113 var message = "Custom authorization error message" ;
146-
147- // Act
148114 var exception = new OAuthAuthorizationException ( message ) ;
149-
150- // Assert
151115 Assert . AreEqual ( message , exception . Message ) ;
152116 Assert . IsNull ( exception . InnerException ) ;
153117 }
154118
155119 [ TestMethod ]
156120 public void OAuthAuthorizationException_WithMessageAndInnerException_ShouldUseBoth ( )
157121 {
158- // Arrange
122+
159123 var message = "Custom authorization error message" ;
160124 var innerException = new InvalidOperationException ( "Inner exception" ) ;
161-
162- // Act
163125 var exception = new OAuthAuthorizationException ( message , innerException ) ;
164-
165- // Assert
166126 Assert . AreEqual ( message , exception . Message ) ;
167127 Assert . AreEqual ( innerException , exception . InnerException ) ;
168128 }
169129
170130 [ TestMethod ]
171131 public void OAuthTokenRefreshException_DefaultConstructor_ShouldUseDefaultMessage ( )
172132 {
173- // Act
174- var exception = new OAuthTokenRefreshException ( ) ;
175133
176- // Assert
134+ var exception = new OAuthTokenRefreshException ( ) ;
177135 Assert . AreEqual ( "OAuth token refresh failed." , exception . Message ) ;
178136 Assert . IsNull ( exception . InnerException ) ;
179137 }
180138
181139 [ TestMethod ]
182140 public void OAuthTokenRefreshException_WithMessage_ShouldUseProvidedMessage ( )
183141 {
184- // Arrange
142+
185143 var message = "Custom refresh error message" ;
186-
187- // Act
188144 var exception = new OAuthTokenRefreshException ( message ) ;
189-
190- // Assert
191145 Assert . AreEqual ( message , exception . Message ) ;
192146 Assert . IsNull ( exception . InnerException ) ;
193147 }
194148
195149 [ TestMethod ]
196150 public void OAuthTokenRefreshException_WithMessageAndInnerException_ShouldUseBoth ( )
197151 {
198- // Arrange
152+
199153 var message = "Custom refresh error message" ;
200154 var innerException = new InvalidOperationException ( "Inner exception" ) ;
201-
202- // Act
203155 var exception = new OAuthTokenRefreshException ( message , innerException ) ;
204-
205- // Assert
206156 Assert . AreEqual ( message , exception . Message ) ;
207157 Assert . AreEqual ( innerException , exception . InnerException ) ;
208158 }
209159
210160 [ TestMethod ]
211161 public void OAuthException_Inheritance_ShouldBeCorrect ( )
212162 {
213- // Act
163+
214164 var oauthException = new OAuthException ( ) ;
215165 var configException = new OAuthConfigurationException ( ) ;
216166 var tokenException = new OAuthTokenException ( ) ;
217167 var authException = new OAuthAuthorizationException ( ) ;
218168 var refreshException = new OAuthTokenRefreshException ( ) ;
219-
220- // Assert
221169 Assert . IsInstanceOfType ( oauthException , typeof ( Exception ) ) ;
222170 Assert . IsInstanceOfType ( configException , typeof ( OAuthException ) ) ;
223171 Assert . IsInstanceOfType ( tokenException , typeof ( OAuthException ) ) ;
@@ -228,10 +176,8 @@ public void OAuthException_Inheritance_ShouldBeCorrect()
228176 [ TestMethod ]
229177 public void OAuthException_Serialization_ShouldWork ( )
230178 {
231- // Arrange
179+
232180 var originalException = new OAuthException ( "Test message" , new InvalidOperationException ( "Inner" ) ) ;
233-
234-
235181 Assert . IsNotNull ( originalException ) ;
236182 Assert . AreEqual ( "Test message" , originalException . Message ) ;
237183 Assert . IsNotNull ( originalException . InnerException ) ;
@@ -240,36 +186,27 @@ public void OAuthException_Serialization_ShouldWork()
240186 [ TestMethod ]
241187 public void OAuthException_ToString_ShouldIncludeMessage ( )
242188 {
243- // Arrange
189+
244190 var message = "Test OAuth error message" ;
245191 var exception = new OAuthException ( message ) ;
246-
247- // Act
248192 var result = exception . ToString ( ) ;
249-
250- // Assert
251193 Assert . IsTrue ( result . Contains ( message ) ) ;
252194 Assert . IsTrue ( result . Contains ( "OAuthException" ) ) ;
253195 }
254196
255197 [ TestMethod ]
256198 public void OAuthException_WithInnerException_ToString_ShouldIncludeBoth ( )
257199 {
258- // Arrange
200+
259201 var message = "Test OAuth error message" ;
260202 var innerMessage = "Inner exception message" ;
261203 var innerException = new InvalidOperationException ( innerMessage ) ;
262204 var exception = new OAuthException ( message , innerException ) ;
263-
264- // Act
265205 var result = exception . ToString ( ) ;
266-
267- // Assert
268206 Assert . IsTrue ( result . Contains ( message ) ) ;
269207 Assert . IsTrue ( result . Contains ( innerMessage ) ) ;
270208 Assert . IsTrue ( result . Contains ( "OAuthException" ) ) ;
271209 Assert . IsTrue ( result . Contains ( "InvalidOperationException" ) ) ;
272210 }
273211 }
274212}
275-
0 commit comments