Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 Copyright 2011 Google Inc | 2 Copyright 2011 Google Inc |
3 | 3 |
4 Licensed under the Apache License, Version 2.0 (the "License"); | 4 Licensed under the Apache License, Version 2.0 (the "License"); |
5 you may not use this file except in compliance with the License. | 5 you may not use this file except in compliance with the License. |
6 You may obtain a copy of the License at | 6 You may obtain a copy of the License at |
7 | 7 |
8 http://www.apache.org/licenses/LICENSE-2.0 | 8 http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 |
10 Unless required by applicable law or agreed to in writing, software | 10 Unless required by applicable law or agreed to in writing, software |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1139 | 1139 |
1140 // ETag has a value, default is override, use the specified ETag action. | 1140 // ETag has a value, default is override, use the specified ETag action. |
1141 request = new TestClientServiceRequest(service, HttpConsts.Get, body); | 1141 request = new TestClientServiceRequest(service, HttpConsts.Get, body); |
1142 request.ETagAction = ETagAction.IfMatch; | 1142 request.ETagAction = ETagAction.IfMatch; |
1143 httpRequest = request.CreateRequest(); | 1143 httpRequest = request.CreateRequest(); |
1144 Assert.That(httpRequest.Headers.IfNoneMatch.Count, Is.EqualTo(0) ); | 1144 Assert.That(httpRequest.Headers.IfNoneMatch.Count, Is.EqualTo(0) ); |
1145 Assert.That(httpRequest.Headers.IfMatch.Count, Is.EqualTo(1)); | 1145 Assert.That(httpRequest.Headers.IfMatch.Count, Is.EqualTo(1)); |
1146 Assert.That(httpRequest.Headers.IfMatch.First(), Is.EqualTo(new EntityTagHeaderValue(body.ETag))); | 1146 Assert.That(httpRequest.Headers.IfMatch.First(), Is.EqualTo(new EntityTagHeaderValue(body.ETag))); |
1147 | 1147 |
1148 // Fixing bug https://code.google.com/p/google-api-dotnet-client /issues/detail?id=464. | 1148 // Fixing bug https://code.google.com/p/google-api-dotnet-client /issues/detail?id=464. |
1149 // Etag doesn't contain quotas - catching the exception and log. | 1149 // If etag doesn't contain quotas - catch the format exception a nd log. |
class
2014/05/15 18:07:53
"catching the exception and log."
Switch to eithe
peleyal
2014/05/15 22:08:49
Done.
| |
1150 body.ETag = "ETAG"; | 1150 body.ETag = "ETAG"; |
1151 request = new TestClientServiceRequest(service, HttpConsts.Post, body); | 1151 request = new TestClientServiceRequest(service, HttpConsts.Post, body); |
1152 httpRequest = request.CreateRequest(); | 1152 httpRequest = request.CreateRequest(); |
1153 Assert.That(httpRequest.Headers.IfNoneMatch.Count, Is.EqualTo(0) ); | 1153 Assert.That(httpRequest.Headers.IfNoneMatch.Count, Is.EqualTo(0) ); |
1154 Assert.That(httpRequest.Headers.IfMatch.Count, Is.EqualTo(0)); | 1154 Assert.That(httpRequest.Headers.IfMatch.Count, Is.EqualTo(0)); |
1155 } | 1155 } |
1156 } | 1156 } |
1157 | 1157 |
1158 /// <summary>Tests that get default ETag action works as expected.</summ ary> | 1158 /// <summary>Tests that get default ETag action works as expected.</summ ary> |
1159 [Test] | 1159 [Test] |
1160 public void GetDefaultETagActionTest() | 1160 public void GetDefaultETagActionTest() |
1161 { | 1161 { |
1162 Assert.AreEqual(ETagAction.IfNoneMatch, ClientServiceRequest<object> .GetDefaultETagAction(HttpConsts.Get)); | 1162 Assert.AreEqual(ETagAction.IfNoneMatch, ClientServiceRequest<object> .GetDefaultETagAction(HttpConsts.Get)); |
1163 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Post)); | 1163 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Post)); |
1164 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Patch)); | 1164 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Patch)); |
1165 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Put)); | 1165 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Put)); |
1166 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Delete)); | 1166 Assert.AreEqual(ETagAction.IfMatch, ClientServiceRequest<object>.Get DefaultETagAction(HttpConsts.Delete)); |
1167 Assert.AreEqual(ETagAction.Ignore, ClientServiceRequest<object>.GetD efaultETagAction("INVALID")); | 1167 Assert.AreEqual(ETagAction.Ignore, ClientServiceRequest<object>.GetD efaultETagAction("INVALID")); |
1168 } | 1168 } |
1169 | 1169 |
1170 #endregion | 1170 #endregion |
1171 } | 1171 } |
1172 } | 1172 } |
LEFT | RIGHT |