Skip to content

Commit

Permalink
Added test for #19, bumped version to 1.11.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Dec 18, 2015
1 parent 4d76673 commit 036fde0
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ShopifySharp.Tests/Playlists/Orders.playlist
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Playlist Version="1.0"><Add Test="ShopifySharp.Tests.When_getting_an_order::should_get_an_order" /><Add Test="ShopifySharp.Tests.When_updating_an_order::should_update_an_order" /><Add Test="ShopifySharp.Tests.When_opening_an_order::should_open_an_order" /><Add Test="ShopifySharp.Tests.When_closing_an_order::should_close_an_order" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_only_list_2_orders" /><Add Test="ShopifySharp.Tests.When_deleting_an_order::should_delete_an_order" /><Add Test="ShopifySharp.Tests.When_counting_orders::should_retrieve_a_count_of_orders" /><Add Test="ShopifySharp.Tests.When_listing_orders::should_list_orders" /><Add Test="ShopifySharp.Tests.When_creating_an_order::should_create_an_order" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_list_orders_with_a_specific_id" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_list_orders_with_specific_ids" /></Playlist>
<Playlist Version="1.0"><Add Test="ShopifySharp.Tests.When_getting_an_order::should_get_an_order" /><Add Test="ShopifySharp.Tests.When_updating_an_order::should_update_an_order" /><Add Test="ShopifySharp.Tests.When_opening_an_order::should_open_an_order" /><Add Test="ShopifySharp.Tests.When_closing_an_order::should_close_an_order" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_only_list_2_orders" /><Add Test="ShopifySharp.Tests.When_deleting_an_order::should_delete_an_order" /><Add Test="ShopifySharp.Tests.When_counting_orders::should_retrieve_a_count_of_orders" /><Add Test="ShopifySharp.Tests.When_listing_orders::should_list_orders" /><Add Test="ShopifySharp.Tests.When_creating_an_order::should_create_an_order" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_list_orders_with_a_specific_id" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_options::should_list_orders_with_specific_ids" /><Add Test="ShopifySharp.Tests.When_listing_orders_with_since_id::should_list_orders_greater_than_since_id" /></Playlist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using Machine.Specifications;
using ShopifySharp.Tests.Test_Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShopifySharp.Tests
{
[Subject(typeof(ShopifyOrderService))]
public class When_listing_orders_with_since_id
{
Establish context = () =>
{
Service = new ShopifyOrderService(Utils.MyShopifyUrl, Utils.AccessToken);
for (int i = 0; i < 5; i++)
{
var order = Service.CreateAsync(OrderCreation.CreateValidOrder()).Await().AsTask.Result;
CreatedIds.Add(order.Id.Value);
}
SinceId = CreatedIds[2];
Options = new ShopifyOrderFilterOptions()
{
SinceId = SinceId
};
};

Because of = () =>
{
Result = Service.ListAsync(Options).Await().AsTask.Result;
};

It should_list_orders_greater_than_since_id = () =>
{
Result.ShouldNotBeNull();
Result.All(order => order.Id > SinceId).ShouldBeTrue();
};

Cleanup after = () =>
{
foreach (var id in CreatedIds)
{
Service.DeleteAsync(id).Await();
}
};

static long SinceId;

static ShopifyOrderService Service;

static IEnumerable<ShopifyOrder> Result;

static ShopifyOrderFilterOptions Options;

static List<long> CreatedIds = new List<long>();
}
}
1 change: 1 addition & 0 deletions ShopifySharp.Tests/ShopifySharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<Compile Include="ShopifyChargeService Tests\When_creating_a_charge.cs" />
<Compile Include="ShopifyChargeService Tests\When_listing_charges.cs" />
<Compile Include="ShopifyChargeService Tests\When_retrieving_a_charge.cs" />
<Compile Include="ShopifyOrderService Tests\When_listing_orders_with_since_id.cs" />
<Compile Include="ShopifyProductService Tests\Test_Data\ProductCreation.cs" />
<Compile Include="ShopifyProductService Tests\When_deleting_a_product.cs" />
<Compile Include="ShopifyProductService Tests\When_getting_a_list_of_products - Copy.cs" />
Expand Down
2 changes: 1 addition & 1 deletion ShopifySharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.11.3.0")]
[assembly: AssemblyVersion("1.11.4.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
2 changes: 1 addition & 1 deletion ShopifySharp/Services/Order/ShopifyOrderFilterOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ShopifyOrderFilterOptions : ShopifyFilterOptions
/// Restrict results to after the specified ID.
/// </summary>
[JsonProperty("since_id")]
public long? SinceId { get; set; };
public long? SinceId { get; set; }

/// <summary>
/// The status of orders to retrieve. Default is <see cref="ShopifyOrderStatus.Any"/>.
Expand Down
8 changes: 8 additions & 0 deletions ShopifySharp/ShopifySharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ShopifySharp is a .NET library that enables you to authenticate and make API calls to Shopify.</description>
<releaseNotes>
1.11.4
======
- Adds a `SinceId` filter to `ShopifyOrderFilterOptions`, letting you filter a list of orders to those created after the given id.

1.11.3
======
- Makes ShopifyShop.PasswordEnabled a nullable Boolean. Null values here previously threw a deserialization exception.

1.11.2
======
- Fixed a bug ShopifyOrderService.ListAsync and ShopifyProductService.ListAsync where filtering the results to specific ids was broken.
Expand Down

0 comments on commit 036fde0

Please sign in to comment.