コード例 #1
0
        public void Test_FetchBookInfoBookProviderReturnNull_ReturnEmptyList()
        {
            // Create the mock
            var reqManagerMock = new Mock <IRestRequestManager>();

            // Configure the mock to do something
            reqManagerMock.Setup(x => x.ExecuteGet()).Returns <IRestResponseManager>(null);

            IBooksProvider provider = new GoogleBookProvider(reqManagerMock.Object);

            var res = provider.FetchBookInfo(new PocoBook("test", "myTitle", new Collection <string>(), "", "test"));

            Assert.IsTrue(!res.Any());
        }
コード例 #2
0
        public void Test_FetchBookInfoBookEmpty()
        {
            IBooksProvider provider = new GoogleBookProvider(new RequestManager(new RestClient()));

            Assert.Throws <ArgumentNullException>(() => provider.FetchBookInfo(new PocoBook()));
        }