コード例 #1
0
        public void ListAll_ReturnsNonEmptyListWhenPackagesAreAvailable()
        {
            // Returned content
            var mpl = new ResponseWithContentBody <List <PackageHeader> >
            {
                content = new List <PackageHeader>()
                {
                    new PackageHeader()
                },
                success = true
            };

            // Returns mpl for any arguments
            var c = new Mock <IGregClient>();

            c.Setup(x =>
                    x.ExecuteAndDeserializeWithContent <List <PackageHeader> >(It.IsAny <HeaderCollectionDownload>()))
            .Returns(mpl);

            var m = new PackageManagerClient(c.Object, MockMaker.Empty <IPackageUploadBuilder>());

            var pl = m.ListAll();

            Assert.AreNotEqual(0, pl.Count());
        }
コード例 #2
0
        public void ListAll_ReturnsEmptyListWhenQueryThrowsException()
        {
            // Returns mpl for any arguments
            var c = new Mock<IGregClient>();
            c.Setup(x =>
                x.ExecuteAndDeserializeWithContent<List<PackageHeader>>(It.IsAny<HeaderCollectionDownload>()))
                .Throws(new Exception("Fail!"));

            var m = new PackageManagerClient(c.Object, MockMaker.Empty<IPackageUploadBuilder>(), "");

            var pl = m.ListAll();
            Assert.AreEqual(0, pl.Count());
        }
コード例 #3
0
        public void ListAll_ReturnsEmptyListWhenQueryThrowsException()
        {
            // Returns mpl for any arguments
            var c = new Mock <IGregClient>();

            c.Setup(x =>
                    x.ExecuteAndDeserializeWithContent <List <PackageHeader> >(It.IsAny <HeaderCollectionDownload>()))
            .Throws(new Exception("Fail!"));

            var m = new PackageManagerClient(c.Object, MockMaker.Empty <IPackageUploadBuilder>());

            var pl = m.ListAll();

            Assert.AreEqual(0, pl.Count());
        }
コード例 #4
0
        public void ListAll_ReturnsNonEmptyListWhenPackagesAreAvailable()
        {
            // Returned content
            var mpl = new ResponseWithContentBody<List<PackageHeader>>
            {
                content = new List<PackageHeader>()
                {
                    new PackageHeader()
                },
                success = true
            };

            // Returns mpl for any arguments
            var c = new Mock<IGregClient>();
            c.Setup(x =>
                x.ExecuteAndDeserializeWithContent<List<PackageHeader>>(It.IsAny<HeaderCollectionDownload>()))
                .Returns(mpl);

            var m = new PackageManagerClient(c.Object, MockMaker.Empty<IPackageUploadBuilder>(), "");

            var pl = m.ListAll();
            Assert.AreNotEqual(0, pl.Count());
        }