Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0 remove enums and replace them with strings. #65

Merged
merged 31 commits into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cbe9842
Remove splintered ShopifyFulfillmentStatus enum, replace with string.
nozzlegear Sep 8, 2016
6a5b42c
Merge branch 'master' into 3.0
nozzlegear Sep 13, 2016
a98fa7c
Remove ShopifyOrderStatus enum
nozzlegear Sep 13, 2016
bfc5bae
Remove OrderFinancialStatus enum
nozzlegear Sep 13, 2016
97f2556
Remove OrderCancelReason enum
nozzlegear Sep 13, 2016
2c29929
Don't default the 'Status' property to 'any'
nozzlegear Sep 19, 2016
7a87019
Remove ShopifyAssetType enum
nozzlegear Sep 19, 2016
33fd47d
Remove ShopifYChargeStatus enum
nozzlegear Sep 19, 2016
19f8d7b
Remove ShopifyDiscountCodeType enum
nozzlegear Sep 19, 2016
1df7ce2
Remove ShopifyOrderCreateOptions enum
nozzlegear Sep 19, 2016
5a4aed9
Remove ShopifyProcessingMethod enum
nozzlegear Sep 19, 2016
157a795
Remove ShopifyProductInventoryManagement enum
nozzlegear Sep 19, 2016
97df852
Remove ShopifyProductInventoryPolicy enum
nozzlegear Sep 19, 2016
96945b1
Remove ShopifyThemeRole enum
nozzlegear Sep 19, 2016
4986db4
Remove ShopifyScriptTagEvent enum
nozzlegear Sep 19, 2016
611dde2
Remove ShopifyTransactionKind enum
nozzlegear Sep 19, 2016
3a6b229
Remove ShopifyWebhookTopic enum
nozzlegear Sep 19, 2016
b2b435d
Remove ShopifyTransactionError enum
nozzlegear Sep 19, 2016
903110e
Let .BuildAuthorizationUrl accept a list of enum permissions or strin…
nozzlegear Sep 19, 2016
36cc85b
Bump to 3.0.0
nozzlegear Sep 19, 2016
4991a56
Do not send notification emails during tests.
nozzlegear Sep 21, 2016
39a805e
Ignore charge tests
nozzlegear Sep 21, 2016
dbab9e6
Do not require the nullable .Path to not be null
nozzlegear Sep 21, 2016
6e5a198
Ignore recurring charge tests
nozzlegear Sep 21, 2016
e2c19af
Check that role is null *or* empty
nozzlegear Sep 21, 2016
a2af484
Do not check for 'uknown_value' deserialization.
nozzlegear Sep 21, 2016
e18337d
Update README
nozzlegear Sep 21, 2016
e20fdc4
Update nuget package
nozzlegear Sep 21, 2016
9ab237f
Remove enums from docs
nozzlegear Sep 21, 2016
917cbe5
Document 'open' as a known value for .Status
nozzlegear Sep 21, 2016
8df13df
Document known enum values
nozzlegear Sep 21, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ class When_activating_a_charge
Charge = Service.GetAsync(Charge.Id.Value).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_activate_a_charge = () =>
{
// NOTE: This test will require you to set a break point after creating the charge but before activating it,
// grab the confirmation url and manually accept it, then continue the test.
Charge.Status.ShouldEqual(Enums.ShopifyChargeStatus.Active);
Charge.Status.ShouldEqual("active");
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class When_creating_a_charge
Charge = Service.CreateAsync(Charge).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_create_a_charge = () =>
{
Charge.ConfirmationUrl.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class When_listing_charges
Charges = Service.ListAsync().Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_retrieve_a_list_of_charges = () =>
{
Charges.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class When_retrieving_a_charge
Charge = Service.GetAsync(ChargeId).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_retrieve_a_charge = () =>
{
Charge.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class When_publishing_a_custom_collection
It should_publish_a_custom_collection = () =>
{
Collection.ShouldNotBeNull();
Collection.PublishedAt.ShouldNotBeNull();
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class When_getting_an_event
Event.Author.ShouldNotBeNull();
Event.CreatedAt.HasValue.ShouldBeTrue();
Event.Message.ShouldNotBeNull();
Event.Path.ShouldNotBeNull();
Event.SubjectId.ShouldBeGreaterThan(0);
Event.SubjectType.ShouldNotBeNull();
Event.Verb.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_cancelling_a_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment();

Id = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_completing_a_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment();

Id = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class When_counting_fulfillments
var items = Order.LineItems.Skip(i).Take(1);
var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items);

Service.CreateAsync(Order.Id.Value, fulfillment, true).Await();
Service.CreateAsync(Order.Id.Value, fulfillment, false).Await();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class When_counting_fulfillments_with_a_filter
var items = Order.LineItems.Skip(i).Take(1);
var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items);

Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, true).Await().AsTask.Result);
Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, false).Await().AsTask.Result);

//Wait 1 second so created fulfillments have differing times.
Thread.Sleep(1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_creating_a_fulfillment
Because of = () =>
{
Fulfillment = Service
.CreateAsync(Order.Id.Value, FulfillmentCreation.GenerateFulfillment(), true)
.CreateAsync(Order.Id.Value, FulfillmentCreation.GenerateFulfillment(), false)
.Await()
.AsTask
.Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class When_creating_a_fulfillment_with_multiple_tracking_numbers
var fulfillment = FulfillmentCreation.GenerateFulfillment(true);

Fulfillment = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class When_creating_a_partial_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment(false, Order.LineItems.Take(1));

Fulfillment = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result;
Expand All @@ -33,11 +33,6 @@ class When_creating_a_partial_fulfillment
Fulfillment.ShouldNotBeNull();
Fulfillment.Id.HasValue.ShouldBeTrue();
Fulfillment.Status.Equals("success", System.StringComparison.OrdinalIgnoreCase).ShouldBeTrue();

Fulfillment
.LineItems
.Count(f => f.FulfillmentStatus == Enums.ShopifyFulfillmentStatus.Partial)
.ShouldEqual(1);
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class When_creating_a_single_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment(false, Order.LineItems.Take(1));

Fulfillment = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result;
Expand All @@ -29,11 +29,6 @@ class When_creating_a_single_fulfillment
Fulfillment.ShouldNotBeNull();
Fulfillment.Id.HasValue.ShouldBeTrue();
Fulfillment.Status.Equals("success", System.StringComparison.OrdinalIgnoreCase).ShouldBeTrue();

Fulfillment
.LineItems
.Count(f => f.FulfillmentStatus == Enums.ShopifyFulfillmentStatus.Fulfilled)
.ShouldEqual(1);
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_getting_a_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment();

Id = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class When_listing_fulfillments
var items = Order.LineItems.Skip(i).Take(1);
var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items);

Service.CreateAsync(Order.Id.Value, fulfillment, true).Await();
Service.CreateAsync(Order.Id.Value, fulfillment, false).Await();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class When_listing_fulfillments_with_a_filter
var items = Order.LineItems.Skip(i).Take(1);
var fulfillment = FulfillmentCreation.GenerateFulfillment(items: items);

Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, true).Await().AsTask.Result);
Created.Add(Service.CreateAsync(Order.Id.Value, fulfillment, false).Await().AsTask.Result);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_updating_a_fulfillment
var fulfillment = FulfillmentCreation.GenerateFulfillment();

Created = Service
.CreateAsync(Order.Id.Value, fulfillment, true)
.CreateAsync(Order.Id.Value, fulfillment, false)
.Await()
.AsTask
.Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public static ShopifyOrder GenerateOrder()
Price = 5
}
},
FinancialStatus = Enums.ShopifyOrderFinancialStatus.Paid,
FinancialStatus = "paid",
TotalPrice = 5.00,
Transactions = new List<ShopifyTransaction>()
{
new ShopifyTransaction()
{
Amount = 20.00,
Status = "success",
Kind = Enums.ShopifyTransactionKind.Authorization,
Kind = "authorization",
Test = true,
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class When_activating_a_recurring_charge
Charge = Service.GetAsync(Charge.Id.Value).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_activate_a_recurring_charge = () =>
{
// NOTE: This test will require you to set a break point after creating the charge but before activating it,
// grab the confirmation url and manually accept it, then continue the test.
Charge.Status.ShouldEqual(Enums.ShopifyChargeStatus.Active);
Charge.Status.ShouldEqual("active");
Charge.ActivatedOn.ShouldNotBeNull();
Charge.TrialEndsOn.ShouldNotBeNull();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class When_creating_a_recurring_charge
Charge = Service.CreateAsync(Charge).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_create_a_recurring_charge = () =>
{
Charge.ConfirmationUrl.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class When_deleting_a_recurring_charge
}
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_delete_a_recurring_charge = () =>
{
// A charge cannot be deleted unless it has been activated. This test will fail unless you manually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class When_listing_recurring_charges
Charges = Service.ListAsync().Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_retrieve_a_list_of_recurring_charges = () =>
{
Charges.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class When_retrieving_a_recurring_charge
Charge = Service.GetAsync(ChargeId).Await().AsTask.Result;
};

[Ignore("Charge tests cannot be run automatically; they require manual confirmation.")]
It should_retrieve_a_recurring_charge = () =>
{
Charge.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class When_counting_script_tags

Tags.Add(Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = src
}).Await().AsTask.Result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class When_creating_a_script_tag
{
Tag = Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = "https://nozzlegear.com/test.js"
}).Await().AsTask.Result;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_deleting_a_script_tag
Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken);
Tag = Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = "https://nozzlegear.com/test.js"
}).Await().AsTask.Result;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_getting_a_script_tag
Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken);
TagId = Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = "https://nozzlegear.com/test.js"
}).Await().AsTask.Result.Id.Value;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class When_listing_script_tags

Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = src
}).Await();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class When_updating_a_script_tag
Service = new ShopifyScriptTagService(Utils.MyShopifyUrl, Utils.AccessToken);
OriginalTag = Service.CreateAsync(new ShopifyScriptTag()
{
Event = Enums.ShopifyScriptTagEvent.Onload,
Event = "onload",
Src = "https://nozzlegear.com/test.js"
}).Await().AsTask.Result;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static ShopifyTheme CreateValidTheme()
return new ShopifyTheme()
{
Name = "My new theme.",
Role = Enums.ShopifyThemeRole.Unpublished
Role = "unpublished"
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class When_creating_a_themes
It should_create_a_theme = () =>
{
Theme.Id.HasValue.ShouldBeTrue();
Theme.Role.ShouldEqual(Enums.ShopifyThemeRole.Unpublished);
Theme.Role.ShouldEqual("unpublished");
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,29 @@ class When_deserializing_a_theme

Because of = () =>
{
Theme1 = JsonConvert.DeserializeObject<ShopifyTheme>(Theme1Json);
Theme1 = JsonConvert.DeserializeObject<ShopifyTheme>(Theme1Json);

Theme2 = JsonConvert.DeserializeObject<ShopifyTheme>(Theme2Json);

Theme3 = JsonConvert.DeserializeObject<ShopifyTheme>(Theme3Json);
};

It should_deserialize_a_theme = () =>
{
Theme1.Role.ShouldBeNull();

Theme2.Role.ShouldBeNull();

Theme3.Role.ShouldEqual(Enums.ShopifyThemeRole.Main);
string.IsNullOrEmpty(Theme1.Role).ShouldBeTrue();

Theme2.Role.ShouldEqual("main");
};

Cleanup after = () =>
{

};

static string Theme1Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}";
static string Theme1Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}";

static string Theme2Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"unknown_value\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}";
static string Theme2Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"main\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}";

static string Theme3Json { get; } = "{\"id\":10556555,\"name\":\"launchpad-star\",\"created_at\":\"2014-09-03T11:20:41-05:00\",\"updated_at\":\"2015-11-11T11:28:59-06:00\",\"role\":\"main\",\"theme_store_id\":null,\"previewable\":true,\"processing\":false}";

static ShopifyTheme Theme1 { get; set; }
static ShopifyTheme Theme1 { get; set; }

static ShopifyTheme Theme2 { get; set; }

static ShopifyTheme Theme3 { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class When_updating_a_themes
}

Theme.Name = UpdatedThemeName;
Theme.Role = Enums.ShopifyThemeRole.Main;
Theme.Role = "main";
};

Because of = () =>
Expand All @@ -45,7 +45,7 @@ class When_updating_a_themes
It should_update_a_themes = () =>
{
Theme.Name.ShouldEqual(UpdatedThemeName);
Theme.Role.ShouldEqual(Enums.ShopifyThemeRole.Main);
Theme.Role.ShouldEqual("main");
};

Cleanup after = () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class Setup
/// <summary>
/// Generates a valid <see cref="ShopifyTransaction"/> for testing the Transaction API.
/// </summary>
public static ShopifyTransaction GenerateTransaction(ShopifyTransactionKind kind = ShopifyTransactionKind.Authorization , double? amount = null)
public static ShopifyTransaction GenerateTransaction(string kind = "authorization", double? amount = null)
{
return new ShopifyTransaction()
{
Expand Down
Loading