-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
756a209
commit 66cc2c1
Showing
2 changed files
with
85 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using FluentAssertions; | ||
using JetBrains.Annotations; | ||
using ShopifySharp.Credentials; | ||
using ShopifySharp.Factories; | ||
using Xunit; | ||
|
||
namespace ShopifySharp.Tests.Factories; | ||
|
||
[TestSubject(typeof(OrderServiceFactory))] | ||
[Trait("Category", "Factories")] | ||
public class OrderServiceFactoryTest | ||
{ | ||
private const string ShopDomain = "some-shop-domain"; | ||
private const string AccessToken = "some-access-token"; | ||
|
||
private readonly OrderServiceFactory _factory = new(); | ||
|
||
[Fact] | ||
public void Create_ReturnsTheService() | ||
{ | ||
// Act | ||
var service = _factory.Create(ShopDomain, AccessToken); | ||
|
||
// Assert | ||
service.Should().NotBeNull(); | ||
service.Should().BeOfType<OrderService>().And.BeAssignableTo<IOrderService>(); | ||
} | ||
|
||
[Fact] | ||
public void Create_WhenGivenShopifyPartnerApiCredentials_ReturnsTheService() | ||
{ | ||
// Setup | ||
var credentials = new ShopifyApiCredentials(ShopDomain, AccessToken); | ||
|
||
// Act | ||
var service = _factory.Create(credentials); | ||
|
||
// Assert | ||
service.Should().NotBeNull(); | ||
service.Should().BeOfType<OrderService>().And.BeAssignableTo<IOrderService>(); | ||
} | ||
} |
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 @@ | ||
#nullable enable | ||
using FluentAssertions; | ||
using JetBrains.Annotations; | ||
using ShopifySharp.Credentials; | ||
using ShopifySharp.Factories; | ||
using Xunit; | ||
|
||
namespace ShopifySharp.Tests.Factories; | ||
|
||
[TestSubject(typeof(PartnerServiceFactory))] | ||
[Trait("Category", "Factories")] | ||
public class PartnerServiceFactoryTest | ||
{ | ||
private const long OrganizationId = 123L; | ||
private const string AccessToken = "some-access-token"; | ||
|
||
private readonly PartnerServiceFactory _factory = new(); | ||
|
||
[Fact] | ||
public void Create_ReturnsTheService() | ||
{ | ||
// Act | ||
var service = _factory.Create(OrganizationId, AccessToken); | ||
|
||
// Assert | ||
service.Should().NotBeNull(); | ||
service.Should().BeOfType<PartnerService>().And.BeAssignableTo<IPartnerService>(); | ||
} | ||
|
||
[Fact] | ||
public void Create_WhenGivenShopifyPartnerApiCredentials_ReturnsTheService() | ||
{ | ||
// Setup | ||
var credentials = new ShopifyPartnerApiCredentials(OrganizationId, AccessToken); | ||
|
||
// Act | ||
var service = _factory.Create(credentials); | ||
|
||
// Assert | ||
service.Should().NotBeNull(); | ||
service.Should().BeOfType<PartnerService>().And.BeAssignableTo<IPartnerService>(); | ||
} | ||
} |