Skip to content

Commit

Permalink
Reverted breaking commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnmbond committed Mar 25, 2024
1 parent 4568b11 commit f156caf
Show file tree
Hide file tree
Showing 52 changed files with 639 additions and 630 deletions.
16 changes: 8 additions & 8 deletions src/Simple.OData.Client.IntegrationTests/BatchODataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public async Task InsertSingleEntityWithSingleAssociationSingleBatch()
.Expand(ProductCategoryName)
.Filter("Name eq 'Test14'")
.FindEntryAsync();
ProductCategoryFunc(product)["ID"].Should().Be(5013);
Assert.Equal(5013, ProductCategoryFunc(product)["ID"]);
}

[Fact]
Expand Down Expand Up @@ -170,7 +170,7 @@ public async Task ExecuteXCsrfFetchPriorToBatchExecution()
await client.GetMetadataDocumentAsync();

// Since the token was never updated it should still be an empty string.
token.Should().NotBeNull();
Assert.NotNull(token);

// Change the settings for the client so we can re-use the session and create a new request with different headers
var newHeaders = new Dictionary<string, IEnumerable<string>>
Expand Down Expand Up @@ -213,8 +213,8 @@ public async Task IgnoreResourceNotFoundExceptionInBatchRequest()

await batch.ExecuteAsync();

bread.Should().ContainKey("ID");
milk.Should().ContainKey("ID");
Assert.True(bread.ContainsKey("ID"));
Assert.True(milk.ContainsKey("ID"));
}

[Fact]
Expand All @@ -234,8 +234,8 @@ public async Task InsertWithoutResultsReadingLocationHeader()
response = await x.GetResponseAsync(request);
};
await batch.ExecuteAsync();
response.Should().NotBeNull();
response.Location.Should().Be($"{_serviceUri}Products({id})");
Assert.NotNull(response);
Assert.Equal($"{_serviceUri}Products({id})", response.Location);
}

[Fact]
Expand All @@ -255,7 +255,7 @@ public async Task InsertReadingLocationHeader()
response = await x.GetResponseAsync(request);
};
await batch.ExecuteAsync();
response.Should().NotBeNull();
response.Location.Should().Be($"{_serviceUri}Products({id})");
Assert.NotNull(response);
Assert.Equal($"{_serviceUri}Products({id})", response.Location);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ await _client
.Filter("Name eq 'Test1'")
.FindEntryAsync();

product.Should().BeNull();
Assert.Null(product);
}
}
20 changes: 10 additions & 10 deletions src/Simple.OData.Client.IntegrationTests/ErrorODataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ await _client
}
catch (Exception)
{
true.Should().BeFalse("Expected WebRequestException");
Assert.False(true, "Expected WebRequestException");
}
}

Expand All @@ -65,12 +65,12 @@ await client
.Filter("NonExistingProperty eq 1")
.FindEntryAsync();

true.Should().BeFalse("Expected exception");
Assert.False(true, "Expected exception");
}
catch (WebRequestException ex)
{
ex.Message.Should().NotBeNull();
ex.Message.Should().Be(ex.ReasonPhrase);
Assert.NotNull(ex.Message);
Assert.Equal(ex.ReasonPhrase, ex.Message);
}
}

Expand All @@ -87,12 +87,12 @@ await client
.Filter("NonExistingProperty eq 1")
.FindEntryAsync();

true.Should().BeFalse("Expected exception");
Assert.False(true, "Expected exception");
}
catch (WebRequestException ex)
{
ex.Message.Should().NotBeNull();
ex.Message.Should().Be(ex.Response);
Assert.NotNull(ex.Message);
Assert.Equal(ex.Response, ex.Message);
}
}

Expand All @@ -109,12 +109,12 @@ await client
.Filter("NonExistingProperty eq 1")
.FindEntryAsync();

true.Should().BeFalse("Expected exception");
Assert.False(true, "Expected exception");
}
catch (WebRequestException ex)
{
ex.Message.Should().NotBeNull();
(ex.Message.Contains(ex.ReasonPhrase) && ex.Message.Contains(ex.Response)).Should().BeTrue();
Assert.NotNull(ex.Message);
Assert.True(ex.Message.Contains(ex.ReasonPhrase) && ex.Message.Contains(ex.Response));
}
}
}
20 changes: 10 additions & 10 deletions src/Simple.OData.Client.IntegrationTests/FindNorthwindTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public async Task OrderBy()
.For("Products")
.OrderBy("ProductName")
.FindEntriesAsync()).First();
product["ProductName"].Should().Be("Alice Mutton");
Assert.Equal("Alice Mutton", product["ProductName"]);
}

[Fact]
Expand All @@ -137,8 +137,8 @@ public async Task SelectMultiple()
.For("Products")
.Select("ProductID", "ProductName")
.FindEntryAsync();
product.Keys.Should().Contain("ProductName");
product.Keys.Should().Contain("ProductID");
Assert.Contains("ProductName", product.Keys);
Assert.Contains("ProductID", product.Keys);
}

[Fact]
Expand All @@ -149,7 +149,7 @@ public async Task ExpandOne()
.OrderBy("ProductID")
.Expand("Category")
.FindEntriesAsync()).Last();
(product["Category"] as IDictionary<string, object>)["CategoryName"].Should().Be("Confections");
Assert.Equal("Confections", (product["Category"] as IDictionary<string, object>)["CategoryName"]);
}

[Fact]
Expand Down Expand Up @@ -183,7 +183,7 @@ public async Task ExpandProductsOrderByCategoryName()
.OrderBy(x => x.Category.CategoryName)
.Select(x => x.Category.CategoryName)
.FindEntriesAsync()).Last();
product.Category.CategoryName.Should().Be("Condiments");
Assert.Equal("Condiments", product.Category.CategoryName);
}

[Fact]
Expand All @@ -196,7 +196,7 @@ public async Task ExpandCategoryOrderByProductName()
.Expand(x => x.Products)
.OrderBy(x => x.Products.Select(y => y.ProductName))
.FindEntriesAsync()).Last();
category.Products.Last().ProductName.Should().Be("Röd Kaviar");
Assert.Equal("Röd Kaviar", category.Products.Last().ProductName);
}
}

Expand Down Expand Up @@ -232,7 +232,7 @@ public async Task CombineAll()
.Expand("Category")
.Select("Category")
.FindEntriesAsync()).Single();
(product["Category"] as IDictionary<string, object>)["CategoryName"].Should().Be("Seafood");
Assert.Equal("Seafood", (product["Category"] as IDictionary<string, object>)["CategoryName"]);
}

[Fact]
Expand All @@ -243,7 +243,7 @@ public async Task NavigateToSingle()
.Key(new Entry() { { "ProductID", 2 } })
.NavigateTo("Category")
.FindEntryAsync();
category["CategoryName"].Should().Be("Beverages");
Assert.Equal("Beverages", category["CategoryName"]);
}

[Fact]
Expand All @@ -268,7 +268,7 @@ public async Task NavigateToRecursive()
.NavigateTo("Employees1")
.Key(5)
.FindEntryAsync();
employee["FirstName"].Should().Be("Steven");
Assert.Equal("Steven", employee["FirstName"]);
}

[Fact]
Expand All @@ -280,6 +280,6 @@ public async Task NavigateToRecursiveSingleClause()
.NavigateTo("Employee1/Employee1/Employees1")
.Key(5)
.FindEntryAsync();
employee["FirstName"].Should().Be("Steven");
Assert.Equal("Steven", employee["FirstName"]);
}
}
22 changes: 11 additions & 11 deletions src/Simple.OData.Client.IntegrationTests/FindODataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task OrderBy()
.For("Products")
.OrderBy("Name")
.FindEntriesAsync()).First();
product["Name"].Should().Be("Bread");
Assert.Equal("Bread", product["Name"]);
}

[Fact]
Expand All @@ -89,12 +89,12 @@ public async Task OrderByNestedComplex()
.For("Suppliers")
.OrderBy("Address/City")
.FindEntriesAsync()).First();
supplier["Name"].Should().Be("Tokyo Traders");
Assert.Equal("Tokyo Traders", supplier["Name"]);
supplier = (await _client
.For("Suppliers")
.OrderByDescending("Address/City")
.FindEntriesAsync()).First();
supplier["Name"].Should().Be("Exotic Liquids");
Assert.Equal("Exotic Liquids", supplier["Name"]);
}

[Fact]
Expand All @@ -104,8 +104,8 @@ public async Task SelectMultiple()
.For("Products")
.Select("ID", "Name")
.FindEntryAsync();
product.Keys.Should().Contain("Name");
product.Keys.Should().Contain("ID");
Assert.Contains("Name", product.Keys);
Assert.Contains("ID", product.Keys);
}

[Fact]
Expand All @@ -116,7 +116,7 @@ public async Task ExpandOne()
.OrderBy("ID")
.Expand(ProductCategoryName)
.FindEntriesAsync()).Last();
ProductCategoryFunc(product)["Name"].Should().Be(ExpectedCategory);
Assert.Equal(ExpectedCategory, ProductCategoryFunc(product)["Name"]);
}

[Fact]
Expand Down Expand Up @@ -173,7 +173,7 @@ public async Task CombineAll()
.Expand(ProductCategoryName)
.Select(ProductCategoryName)
.FindEntriesAsync()).Single();
ProductCategoryFunc(product)["Name"].Should().Be(ExpectedCategory);
Assert.Equal(ExpectedCategory, ProductCategoryFunc(product)["Name"]);
}

[Fact]
Expand All @@ -184,7 +184,7 @@ public async Task NavigateToSingle()
.Key(new Dictionary<string, object>() { { "ID", 2 } })
.NavigateTo(ProductCategoryName)
.FindEntryAsync();
category["Name"].Should().Be("Beverages");
Assert.Equal("Beverages", category["Name"]);
}

[Fact]
Expand Down Expand Up @@ -216,7 +216,7 @@ public async Task GetMediaStream()
.Media()
.GetStreamAsync();
var text = Utils.StreamToString(stream);
text.Should().StartWith("Test stream data");
Assert.StartsWith("Test stream data", text);
}

[Fact]
Expand All @@ -234,7 +234,7 @@ public async Task GetNamedMediaStream()
.Media("Photo")
.GetStreamAsync();
var text = Utils.StreamToString(stream);
text.Should().StartWith("Test named stream data");
Assert.StartsWith("Test named stream data", text);
}

private class PersonDetail
Expand All @@ -256,6 +256,6 @@ public async Task GetTypedNamedMediaStream()
.NavigateTo<PersonDetail>()
.Media(x => x.Photo)
.GetStreamAsStringAsync();
text.Should().StartWith("Test named stream data");
Assert.StartsWith("Test named stream data", text);
}
}
18 changes: 9 additions & 9 deletions src/Simple.OData.Client.IntegrationTests/InsertODataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task InsertLookupByID()
.InsertEntryAsync();

((int)product["ID"] > 0).Should().BeTrue();
product["Name"].Should().Be("Test1");
Assert.Equal("Test1", product["Name"]);
}

[Fact]
Expand All @@ -70,7 +70,7 @@ public async Task InsertExpando()
.Set(expando)
.InsertEntryAsync());

((int)product["ID"] > 0).Should().BeTrue();
Assert.True((int)product["ID"] > 0);
}

[Fact]
Expand All @@ -85,14 +85,14 @@ public async Task InsertProductWithCategory()
.Set(CreateProduct(1007, "Test6", category))
.InsertEntryAsync();

product["Name"].Should().Be("Test6");
Assert.Equal("Test6", product["Name"]);
product = await _client
.For("Products")
.Filter("Name eq 'Test6'")
.Expand(ProductCategoryName)
.FindEntryAsync();
product[ProductCategoryName].Should().NotBeNull();
ProductCategoryFunc(product)["ID"].Should().Be(category["ID"]);
Assert.NotNull(product[ProductCategoryName]);
Assert.Equal(category["ID"], ProductCategoryFunc(product)["ID"]);
}

[Fact]
Expand All @@ -105,8 +105,8 @@ public async Task InsertReadingLocationHeader()
.BuildRequestFor()
.InsertEntryAsync();
var response = await _client.GetResponseAsync(withRequest.GetRequest());
response.Should().NotBeNull();
response.Location.Should().Be($"{_serviceUri}Products({id})");
Assert.NotNull(response);
Assert.Equal($"{_serviceUri}Products({id})", response.Location);
}

[Fact]
Expand All @@ -119,7 +119,7 @@ public async Task InsertWithoutResultsReadingLocationHeader()
.BuildRequestFor()
.InsertEntryAsync(false);
var response = await _client.GetResponseAsync(withRequest.GetRequest());
response.Should().NotBeNull();
response.Location.Should().Be($"{_serviceUri}Products({id})");
Assert.NotNull(response);
Assert.Equal($"{_serviceUri}Products({id})", response.Location);
}
}
4 changes: 2 additions & 2 deletions src/Simple.OData.Client.IntegrationTests/LinkODataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ await _client
.FindEntryAsync();
if (ProductCategoryName == "Categories")
{
(product[ProductCategoryName] as IEnumerable).Should().BeEmpty();
Assert.Empty(product[ProductCategoryName] as IEnumerable);
}
else
{
product[ProductCategoryName].Should().BeNull();
Assert.Null(product[ProductCategoryName]);
}
}
}
Loading

0 comments on commit f156caf

Please sign in to comment.