public void Upvote_ReturnsFalseWhenRequestThrowsException() { var gc = new Mock <IGregClient>(); gc.Setup(x => x.ExecuteAndDeserialize(It.IsAny <Upvote>())).Throws <Exception>(); var pc = new PackageManagerClient(gc.Object, MockMaker.Empty <IPackageUploadBuilder>()); var res = pc.Upvote("id"); Assert.IsFalse(res); }
public void Upvote_ReturnsTrueWhenRequestSucceeds() { var gc = new Mock <IGregClient>(); gc.Setup(x => x.ExecuteAndDeserialize(It.IsAny <Upvote>())).Returns(new ResponseBody() { success = true }); var pc = new PackageManagerClient(gc.Object, MockMaker.Empty <IPackageUploadBuilder>()); var res = pc.Upvote("id"); Assert.IsTrue(res); }
public void Upvote_ReturnsFalseWhenRequestThrowsException() { var gc = new Mock<IGregClient>(); gc.Setup(x => x.ExecuteAndDeserialize(It.IsAny<Upvote>())).Throws<Exception>(); var pc = new PackageManagerClient(gc.Object, MockMaker.Empty<IPackageUploadBuilder>(), ""); var res = pc.Upvote("id"); Assert.IsFalse(res); }
public void Upvote_ReturnsTrueWhenRequestSucceeds() { var gc = new Mock<IGregClient>(); gc.Setup(x => x.ExecuteAndDeserialize(It.IsAny<Upvote>())).Returns(new ResponseBody() { success = true }); var pc = new PackageManagerClient(gc.Object, MockMaker.Empty<IPackageUploadBuilder>(), ""); var res = pc.Upvote("id"); Assert.IsTrue(res); }