Esempio n. 1
0
        public void FailureOnGetPackageVersionHeaderByPackageName()
        {
            var mockGreg = new Mock <IGregClient>();

            mockGreg.Setup(m => m.ExecuteAndDeserializeWithContent <PackageVersion>(It.IsAny <Request>()))
            .Returns(new ResponseWithContentBody <PackageVersion>()
            {
                message = "The package does not exist",
                success = false
            });

            var client = new PackageManagerClient(mockGreg.Object, MockMaker.Empty <IPackageUploadBuilder>(), string.Empty);

            client.GetPackageVersionHeader(string.Empty, string.Empty);
        }
Esempio n. 2
0
        public void SuccessfullyGetPackageVersionHeaderByPackageName()
        {
            var version  = "1.0.0";
            var mockGreg = new Mock <IGregClient>();

            mockGreg.Setup(m => m.ExecuteAndDeserializeWithContent <PackageVersion>(It.IsAny <Request>()))
            .Returns(new ResponseWithContentBody <PackageVersion>()
            {
                content = new PackageVersion()
                {
                    version = version
                },
                success = true
            });

            var client = new PackageManagerClient(mockGreg.Object, MockMaker.Empty <IPackageUploadBuilder>(), string.Empty);
            var result = client.GetPackageVersionHeader(string.Empty, version);

            Assert.AreEqual(result.version, version);
        }