-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ThroughputResponse.IsReplacePending (#1023)
* Update ThroughputResponse.cs fix the value that is being retrieved when mapping ThoughputResponse.IsReplacePending * Update changelog.md * add tests
- Loading branch information
1 parent
505b8d9
commit 07dcca0
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
....Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Resource/Throughput/ThroughputResponseTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Net; | ||
using Microsoft.Azure.Documents; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Microsoft.Azure.Cosmos.Resource.Throughput | ||
{ | ||
[TestClass] | ||
public class ThroughputResponseTests | ||
{ | ||
[TestMethod] | ||
public void OfferReplacePendingHeaderNotSetReturnsNull() | ||
{ | ||
ThroughputResponse throughputResponse = | ||
new ThroughputResponse(HttpStatusCode.OK, new Headers(), null, null); | ||
|
||
Assert.IsNull(throughputResponse.IsReplacePending); | ||
} | ||
|
||
[TestMethod] | ||
public void OfferReplacePendingHeaderSetTrueReturnsTrue() | ||
{ | ||
ThroughputResponse throughputResponse = new ThroughputResponse(HttpStatusCode.OK, new Headers | ||
{ | ||
{WFConstants.BackendHeaders.OfferReplacePending, "true"} | ||
}, null, null); | ||
|
||
Assert.IsNotNull(throughputResponse.IsReplacePending); | ||
Assert.IsTrue(throughputResponse.IsReplacePending.Value); | ||
} | ||
|
||
[TestMethod] | ||
public void OfferReplacePendingHeaderSetFalseReturnsFalse() | ||
{ | ||
ThroughputResponse throughputResponse = new ThroughputResponse(HttpStatusCode.OK, new Headers | ||
{ | ||
{WFConstants.BackendHeaders.OfferReplacePending, "false"} | ||
}, null, null); | ||
|
||
Assert.IsNotNull(throughputResponse.IsReplacePending); | ||
Assert.IsFalse(throughputResponse.IsReplacePending.Value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters