public Me Get() { const string tictailJsonReponse = "{" + "\"description\": \"Sells something<br>\"," + "}"; var endpointDummy = new TictailEndpoint(new Uri("https://api.somewhere.com"), "accesstoken_abcdefhiljklmnopqrstuvxuz"); var clientTest = new TictailClientTest(endpointDummy); clientTest.Content = tictailJsonReponse; var repository = new TictailRepository(clientTest); return repository.Me.Get(); }
public void GetStoreNotFound_Theme() { const string tictailJsonReponse = "{" + "\"status\": 404," + "\"message\": \"Not Found. You have requested this URI [/v1/stores/aaa/theme] but did you mean /v1/stores/<id:store_id>/theme or /v1/stores/<id:store_id>/orders or /v1/stores/<id:store_id>/customers ?\", " + "\"params\": {}, " + "\"support_email\": \"[email protected]\"" + "}"; var endpointDummy = new TictailEndpoint(new Uri("https://api.somewhere.com"), "accesstoken_abcdefhiljklmnopqrstuvxuz"); var clientTest = new TictailClientTest(endpointDummy); clientTest.Content = tictailJsonReponse; clientTest.StatusCode = HttpStatusCode.NotFound; var repository = new TictailRepository(clientTest); var ex = Assert.Throws<TictailException>(delegate { repository.Stores.Get("someWrongId"); }); Assert.Equal("Not Found. You have requested this URI [/v1/stores/aaa/theme] but did you mean /v1/stores/<id:store_id>/theme or /v1/stores/<id:store_id>/orders or /v1/stores/<id:store_id>/customers ?", ex.Message); }
public Theme Get() { const string tictailStoreJsonReponse = "{" + "\"id\": \"myStore\"," + "}"; const string tictailThemeJsonReponse = "{" + "\"id\": \"myTheme\"," + "}"; var endpointDummy = new TictailEndpoint(new Uri("https://api.somewhere.com"), "accesstoken_abcdefhiljklmnopqrstuvxuz"); var clientTest = new TictailClientTest(endpointDummy); clientTest.Content = tictailStoreJsonReponse; var repository = new TictailRepository(clientTest); var store = repository.Stores["somestore"]; clientTest.Content = tictailThemeJsonReponse; return store.Theme.Get(); }
public Me DeserializeGet(string value) { var repository = new TictailRepository(new TictailClientTest()); return repository.Me.DeserializeGet(value); }
public Store Patch(string resourceId, PatchStore resource) { const string tictailJsonReponse = "{" + "\"description\": \"A new description\"," + "}"; var endpointDummy = new TictailEndpoint(new Uri("https://api.somewhere.com"), "accesstoken_abcdefhiljklmnopqrstuvxuz"); var clientTest = new TictailClientTest(endpointDummy); clientTest.Content = tictailJsonReponse; var repository = new TictailRepository(clientTest); return repository.Stores.Patch(resourceId, resource); }