Skip to content

Commit 0ec34b4

Browse files
committed
Change ETagsOtherTypesTest for independent parallel running
1 parent aa5a57f commit 0ec34b4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/E2ETest/Microsoft.Test.E2E.AspNet.OData/ETags/ETagsOtherTypesTest.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,21 @@ public async Task GetEntryWithIfNoneMatchShouldReturnNotModifiedETagsTest_ForDou
6868
var result = json.GetValue("value") as JArray;
6969
Assert.NotNull(result);
7070

71-
// check the first
72-
eTag = result[2]["@odata.etag"].ToString();
71+
// check the first unchanged,
72+
// because #0, #1, #2 will change potentially running in parallel by other tests.
73+
eTag = result[3]["@odata.etag"].ToString();
7374
Assert.False(String.IsNullOrEmpty(eTag));
74-
Assert.Equal("W/\"Ni4w\"", eTag);
75+
Assert.Equal("W/\"OC4w\"", eTag);
7576

7677
EntityTagHeaderValue parsedValue;
7778
Assert.True(EntityTagHeaderValue.TryParse(eTag, out parsedValue));
7879
IDictionary<string, object> tags = this.ParseETag(parsedValue);
7980
KeyValuePair<string, object> pair = Assert.Single(tags);
8081
Single value = Assert.IsType<Single>(pair.Value);
81-
Assert.Equal((Single)6.0, value);
82+
Assert.Equal((Single)8.0, value);
8283
}
8384

84-
var getRequestWithEtag = new HttpRequestMessage(HttpMethod.Get, this.BaseAddress + "/double/ETagsCustomers(2)");
85+
var getRequestWithEtag = new HttpRequestMessage(HttpMethod.Get, this.BaseAddress + "/double/ETagsCustomers(3)");
8586
getRequestWithEtag.Headers.IfNoneMatch.ParseAdd(eTag);
8687
using (var response = await Client.SendAsync(getRequestWithEtag))
8788
{
@@ -103,20 +104,21 @@ public async Task GetEntryWithIfNoneMatchShouldReturnNotModifiedETagsTest_ForSho
103104
var result = json.GetValue("value") as JArray;
104105
Assert.NotNull(result);
105106

106-
// check the second
107-
eTag = result[1]["@odata.etag"].ToString();
107+
// check the first unchanged,
108+
// because #0, #1, #2 will change potentially running in parallel by other tests.
109+
eTag = result[3]["@odata.etag"].ToString();
108110
Assert.False(String.IsNullOrEmpty(eTag));
109-
Assert.Equal("W/\"MzI3NjY=\"", eTag);
111+
Assert.Equal("W/\"MzI3NjQ=\"", eTag);
110112

111113
EntityTagHeaderValue parsedValue;
112114
Assert.True(EntityTagHeaderValue.TryParse(eTag, out parsedValue));
113115
IDictionary<string, object> tags = this.ParseETag(parsedValue);
114116
KeyValuePair<string, object> pair = Assert.Single(tags);
115117
int value = Assert.IsType<int>(pair.Value);
116-
Assert.Equal((short)32766, value);
118+
Assert.Equal((short)32764, value);
117119
}
118120

119-
var getRequestWithEtag = new HttpRequestMessage(HttpMethod.Get, this.BaseAddress + "/short/ETagsCustomers(1)");
121+
var getRequestWithEtag = new HttpRequestMessage(HttpMethod.Get, this.BaseAddress + "/short/ETagsCustomers(3)");
120122
getRequestWithEtag.Headers.IfNoneMatch.ParseAdd(eTag);
121123
using (var response = await Client.SendAsync(getRequestWithEtag))
122124
{

0 commit comments

Comments
 (0)