-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Related to issue #20
- Loading branch information
Showing
4 changed files
with
108 additions
and
3 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
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,47 @@ | ||
using FakeItEasy; | ||
using FluentAssertions; | ||
using Kentico.Kontent.Delivery.Abstractions; | ||
using Kontent.Statiq.Tests.Models; | ||
using Kontent.Statiq.Tests.Tools; | ||
using Statiq.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Kontent.Statiq.Tests | ||
{ | ||
public class When_using_the_items_feed | ||
{ | ||
[Fact] | ||
public async Task It_should_invoke_the_correct_endpoint() | ||
{ | ||
// Arrange | ||
var content = new Article | ||
{ | ||
System = new TestContentItemSystemAttributes | ||
{ | ||
Type = "article", | ||
Id = "cf106f4e-30a4-42ef-b313-b8ea3fd3e5c5", | ||
Language = "en-US", | ||
Codename = "coffee_beverages_explained", | ||
Name = "Coffee Beverages Explained", | ||
LastModified = new DateTime(2019, 09, 18, 10, 58, 38, 917) | ||
} | ||
}; | ||
|
||
var deliveryClient = A.Fake<IDeliveryClient>() | ||
.WithFakeContentFeed(content); | ||
|
||
var sut = new Kontent<Article>(deliveryClient) | ||
.WithItemsFeed(); | ||
|
||
// Act | ||
var docs = await sut.ExecuteAsync(A.Fake<IExecutionContext>()); | ||
|
||
// Assert | ||
docs.Should().HaveCount(1); | ||
A.CallTo(() => deliveryClient.GetItemsFeed<Article>(A<IEnumerable<IQueryParameter>>._)).MustHaveHappenedOnceExactly(); | ||
} | ||
} | ||
} |
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
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