Beispiel #1
0
        public void ShouldFetchAListOfAllMatchedModels()
        {
            var callRawExpectation = A.CallTo(() => Shopify.CallRaw(HttpMethod.Get,
                                                                    JsonFormatExpectation(),
                                                                    "/admin/robots", EmptyQueryParametersExpectation(), null));

            callRawExpectation.Returns(TaskForResult <string>("json text!"));

            var translationExpectation = A.CallTo(() => Shopify.TranslateObject <List <Robot> >("robots", "json text!"));

            translationExpectation.Returns(new List <Robot>()
            {
                new Robot()
                {
                    Id = 8889
                }
            });

            var answer = Robots.AsListUnpaginated();

            answer.Wait();

            callRawExpectation.MustHaveHappened();
            translationExpectation.MustHaveHappened();

            Assert.AreEqual(1, answer.Result.Count);
            Assert.NotNull(answer.Result[0].Parts);
            Assert.AreEqual("/admin/robots/8889/parts", answer.Result[0].Parts.Path());
        }