diff --git a/ButterCMS.Tests/ListPagesTests.cs b/ButterCMS.Tests/ListPagesTests.cs index 318f34e..044e6b9 100644 --- a/ButterCMS.Tests/ListPagesTests.cs +++ b/ButterCMS.Tests/ListPagesTests.cs @@ -29,14 +29,14 @@ public void ListPages_ShouldReturnPages() butterClient.MockSuccessfullPagesResponse(parameters: dict); - var response = butterClient.ListPages(PagesMocks.PageType, dict); + var response = butterClient.ListPages(PagesMocks.PageType, dict); var page = response.Data.First(); Assert.AreEqual(page.Name, PagesMocks.Page.Name); Assert.AreEqual(page.Slug, PagesMocks.Page.Slug); Assert.AreEqual(page.Updated, PagesMocks.Page.Updated); Assert.AreEqual(page.PageType, PagesMocks.Page.PageType); - Assert.AreEqual(page.Fields.thing1, PagesMocks.Fields.thing1); - Assert.AreEqual(page.Fields.thing2, PagesMocks.Fields.thing2); + Assert.AreEqual(page.Fields.Thing1, PagesMocks.Fields.Thing1); + Assert.AreEqual(page.Fields.Thing2, PagesMocks.Fields.Thing2); } [Test] @@ -44,28 +44,28 @@ public async Task ListPagesAsync_ShouldReturnPages() { butterClient.MockSuccessfullPagesResponse(); - var response = await butterClient.ListPagesAsync(PagesMocks.PageType); + var response = await butterClient.ListPagesAsync(PagesMocks.PageType); var page = response.Data.First(); Assert.AreEqual(page.Name, PagesMocks.Page.Name); Assert.AreEqual(page.Slug, PagesMocks.Page.Slug); Assert.AreEqual(page.Updated, PagesMocks.Page.Updated); Assert.AreEqual(page.PageType, PagesMocks.Page.PageType); - Assert.AreEqual(page.Fields.thing1, PagesMocks.Fields.thing1); - Assert.AreEqual(page.Fields.thing2, PagesMocks.Fields.thing2); + Assert.AreEqual(page.Fields.Thing1, PagesMocks.Fields.Thing1); + Assert.AreEqual(page.Fields.Thing2, PagesMocks.Fields.Thing2); } [Test] public void ListPages_NoResults_ShouldReturnNull() { - var response = butterClient.ListPages("nothings"); + var response = butterClient.ListPages("nothings"); Assert.IsNull(response); } [Test] public async Task ListPagesAsync_NoResults_ShouldReturnNull() { - var response = await butterClient.ListPagesAsync("nothings"); + var response = await butterClient.ListPagesAsync("nothings"); Assert.IsNull(response); } } diff --git a/ButterCMS.Tests/Mocks/ContentFieldsMocks.cs b/ButterCMS.Tests/Mocks/ContentFieldsMocks.cs index 27cdf72..b031272 100644 --- a/ButterCMS.Tests/Mocks/ContentFieldsMocks.cs +++ b/ButterCMS.Tests/Mocks/ContentFieldsMocks.cs @@ -10,18 +10,18 @@ public static class ContentFieldsMocks { Data = new TeamMembersHeadline() { - homepage_headline = "ButterCMS C# SDK", - team_members = new[] + HomepageHeadline = "ButterCMS C# SDK", + TeamMembers = new[] { - new Team_Members() + new TeamMembers() { - name = "Elon", - bio = "CEO" + Name = "Elon", + Bio = "CEO" }, - new Team_Members() + new TeamMembers() { - name = "Steve", - bio = "CTO" + Name = "Steve", + Bio = "CTO" } } } diff --git a/ButterCMS.Tests/Mocks/PagesMocks.cs b/ButterCMS.Tests/Mocks/PagesMocks.cs index 14a4d90..6731e7f 100644 --- a/ButterCMS.Tests/Mocks/PagesMocks.cs +++ b/ButterCMS.Tests/Mocks/PagesMocks.cs @@ -9,11 +9,11 @@ namespace ButterCMS.Tests { public static class PagesMocks { - public static things Fields = new things() { thing1 = "Bike", thing2 = "MTB" }; + public static Things Fields = new Things() { Thing1 = "Bike", Thing2 = "MTB" }; public const string PageType = "BikeList"; - public static Page Page = new Page() + public static Page Page = new Page() { Name = "Bike page", Slug = "bikes", @@ -22,7 +22,7 @@ public static class PagesMocks Fields = Fields }; - public static PagesResponse PagesResponse = new PagesResponse() + public static PagesResponse PagesResponse = new PagesResponse() { Data = new[] { Page }, Meta = new PageMeta() @@ -33,7 +33,7 @@ public static class PagesMocks } }; - public static PageResponse PageResponse = new PageResponse() + public static PageResponse PageResponse = new PageResponse() { Data = Page, }; @@ -52,7 +52,7 @@ public static void MockSuccessfullPageResponse(this ButterCMSClientWithMockedHtt public static void MockSuccessfullNullPageResponse(this ButterCMSClientWithMockedHttp butterClient, string slug, string pageType = PageType) { - butterClient.MockSuccessfullJSONResponse($"https://api.buttercms.com/v2/pages/{pageType}/{slug}/?auth_token={ButterCMSClientWithMockedHttp.MockedApiKey}", new PageResponse() { Data = null }); + butterClient.MockSuccessfullJSONResponse($"https://api.buttercms.com/v2/pages/{pageType}/{slug}/?auth_token={ButterCMSClientWithMockedHttp.MockedApiKey}", new PageResponse() { Data = null }); } } } diff --git a/ButterCMS.Tests/Models/RecipePage.cs b/ButterCMS.Tests/Models/RecipePage.cs index 31fdcb7..f63fee8 100644 --- a/ButterCMS.Tests/Models/RecipePage.cs +++ b/ButterCMS.Tests/Models/RecipePage.cs @@ -2,11 +2,11 @@ { public class RecipePage { - public string category { get; set; } - public string recipe_name { get; set; } - public string main_ingredient { get; set; } - public double estimated_cooking_time_in_minutes { get; set; } - public string ingredient_list { get; set; } - public string instructions { get; set; } + public string Category { get; set; } + public string RecipeName { get; set; } + public string MainIngredient { get; set; } + public double EstimatedCookingTimeInMinutes { get; set; } + public string IngredientList { get; set; } + public string Instructions { get; set; } } } diff --git a/ButterCMS.Tests/Models/TeamMembersHeadline.cs b/ButterCMS.Tests/Models/TeamMembersHeadline.cs index cca4056..36ce2b6 100644 --- a/ButterCMS.Tests/Models/TeamMembersHeadline.cs +++ b/ButterCMS.Tests/Models/TeamMembersHeadline.cs @@ -3,20 +3,23 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Newtonsoft.Json; namespace ButterCMS.Tests.Models { public class TeamMembersHeadline { - public Team_Members[] team_members { get; set; } - public string homepage_headline { get; set; } + [JsonProperty("team_members")] + public TeamMembers[] TeamMembers { get; set; } + [JsonProperty("homepage_headline")] + public string HomepageHeadline { get; set; } } - public class Team_Members + public class TeamMembers { - public string bio { get; set; } - public string picture { get; set; } - public string name { get; set; } + public string Bio { get; set; } + public string Picture { get; set; } + public string Name { get; set; } } } diff --git a/ButterCMS.Tests/Models/things.cs b/ButterCMS.Tests/Models/things.cs index 13026f0..d6bf187 100644 --- a/ButterCMS.Tests/Models/things.cs +++ b/ButterCMS.Tests/Models/things.cs @@ -6,10 +6,10 @@ namespace ButterCMS.Tests.Models { - public class things + public class Things { - public string thing1 { get; set; } - public string thing2 { get; set; } + public string Thing1 { get; set; } + public string Thing2 { get; set; } } } diff --git a/ButterCMS.Tests/ReadmePageTypeExamples.cs b/ButterCMS.Tests/ReadmePageTypeExamples.cs index 772d6a9..f555106 100644 --- a/ButterCMS.Tests/ReadmePageTypeExamples.cs +++ b/ButterCMS.Tests/ReadmePageTypeExamples.cs @@ -42,12 +42,12 @@ public void ReadmeExample_ListPages() foreach (Page recipe in recipePages.Data) { RecipeViewModel recipeViewModel = new RecipeViewModel(); - recipeViewModel.Category = recipe.Fields.category; - recipeViewModel.RecipeName = recipe.Fields.recipe_name; - recipeViewModel.MainIngredient = recipe.Fields.main_ingredient; - recipeViewModel.EstimatedCookingTimeInMinutes = recipe.Fields.estimated_cooking_time_in_minutes; - recipeViewModel.IngredientList = recipe.Fields.ingredient_list; - recipeViewModel.Instructions = recipe.Fields.instructions; + recipeViewModel.Category = recipe.Fields.Category; + recipeViewModel.RecipeName = recipe.Fields.RecipeName; + recipeViewModel.MainIngredient = recipe.Fields.MainIngredient; + recipeViewModel.EstimatedCookingTimeInMinutes = recipe.Fields.EstimatedCookingTimeInMinutes; + recipeViewModel.IngredientList = recipe.Fields.IngredientList; + recipeViewModel.Instructions = recipe.Fields.Instructions; viewModel.Recipes.Add(recipeViewModel); } @@ -64,12 +64,12 @@ public void ReadmeExample_RetrievePage() PageResponse recipe = butterClient.RetrievePage("recipe", slug); var viewModel = new RecipeViewModel(); - viewModel.Category = recipe.Data.Fields.category; - viewModel.RecipeName = recipe.Data.Fields.recipe_name; - viewModel.MainIngredient = recipe.Data.Fields.main_ingredient; - viewModel.EstimatedCookingTimeInMinutes = recipe.Data.Fields.estimated_cooking_time_in_minutes; - viewModel.IngredientList = recipe.Data.Fields.ingredient_list; - viewModel.Instructions = recipe.Data.Fields.instructions; + viewModel.Category = recipe.Data.Fields.Category; + viewModel.RecipeName = recipe.Data.Fields.RecipeName; + viewModel.MainIngredient = recipe.Data.Fields.MainIngredient; + viewModel.EstimatedCookingTimeInMinutes = recipe.Data.Fields.EstimatedCookingTimeInMinutes; + viewModel.IngredientList = recipe.Data.Fields.IngredientList; + viewModel.Instructions = recipe.Data.Fields.Instructions; viewModel.Updated = recipe.Data.Updated; viewModel.Published = recipe.Data.Published; diff --git a/ButterCMS.Tests/RetrieveContentFieldsTests.cs b/ButterCMS.Tests/RetrieveContentFieldsTests.cs index 592b58d..6535e03 100644 --- a/ButterCMS.Tests/RetrieveContentFieldsTests.cs +++ b/ButterCMS.Tests/RetrieveContentFieldsTests.cs @@ -73,8 +73,8 @@ private void AssertContentFieldJSON(string json, TeamMembersHeadline expected) return; } - Assert.AreEqual(expected.homepage_headline, teamMembersAndHeadline.homepage_headline); - Assert.AreEqual(expected.team_members[0].bio, teamMembersAndHeadline.team_members[0].bio); + Assert.AreEqual(expected.HomepageHeadline, teamMembersAndHeadline.HomepageHeadline); + Assert.AreEqual(expected.TeamMembers[0].Bio, teamMembersAndHeadline.TeamMembers[0].Bio); } [Test] diff --git a/ButterCMS.Tests/RetrievePageTests.cs b/ButterCMS.Tests/RetrievePageTests.cs index 8c8025c..f82bf2c 100644 --- a/ButterCMS.Tests/RetrievePageTests.cs +++ b/ButterCMS.Tests/RetrievePageTests.cs @@ -23,14 +23,14 @@ public void RetrievePage_ShouldReturnPage() { butterClient.MockSuccessfullPageResponse(PagesMocks.Page.Slug); - var response = butterClient.RetrievePage(PagesMocks.Page.PageType, PagesMocks.Page.Slug); + var response = butterClient.RetrievePage(PagesMocks.Page.PageType, PagesMocks.Page.Slug); Assert.IsNotNull(response); var page = response.Data; Assert.AreEqual(PagesMocks.Page.Name, page.Name); Assert.AreEqual(PagesMocks.Page.Slug, page.Slug); Assert.AreEqual(PagesMocks.Page.Updated, page.Updated); - Assert.AreEqual(PagesMocks.Page.Fields.thing1, page.Fields.thing1); + Assert.AreEqual(PagesMocks.Page.Fields.Thing1, page.Fields.Thing1); } [Test] @@ -38,14 +38,14 @@ public async Task RetrievePageAsync_ShouldReturnPage() { butterClient.MockSuccessfullPageResponse(PagesMocks.Page.Slug); - var response = await butterClient.RetrievePageAsync(PagesMocks.Page.PageType, PagesMocks.Page.Slug); + var response = await butterClient.RetrievePageAsync(PagesMocks.Page.PageType, PagesMocks.Page.Slug); Assert.IsNotNull(response); var page = response.Data; Assert.AreEqual(PagesMocks.Page.Name, page.Name); Assert.AreEqual(PagesMocks.Page.Slug, page.Slug); Assert.AreEqual(PagesMocks.Page.Updated, page.Updated); - Assert.AreEqual(PagesMocks.Page.Fields.thing1, page.Fields.thing1); + Assert.AreEqual(PagesMocks.Page.Fields.Thing1, page.Fields.Thing1); } [Test] @@ -55,7 +55,7 @@ public void RetrievePage_NoResults_ShouldReturnNull() butterClient.MockSuccessfullNullPageResponse(slug); - var response = butterClient.RetrievePage(slug, slug); + var response = butterClient.RetrievePage(slug, slug); Assert.IsNull(response); } @@ -66,7 +66,7 @@ public async Task RetrievePageAsync_NoResults_ShouldReturnNull() butterClient.MockSuccessfullNullPageResponse(slug); - var response = await butterClient.RetrievePageAsync(slug, slug); + var response = await butterClient.RetrievePageAsync(slug, slug); Assert.IsNull(response); } }