private bool CanDeprecate() { if (!dynamoViewModel.Model.AuthenticationManager.HasAuthProvider) { return(false); } return(packageManagerClient.DoesCurrentUserOwnPackage(Model, dynamoViewModel.Model.AuthenticationManager.Username)); }
private bool CanDeprecate() { if (!CanPublish) { return(false); } return(packageManagerClient.DoesCurrentUserOwnPackage(Model, dynamoModel.AuthenticationManager.Username)); }
public void DoesCurrentUserOwnPackage_ReturnsTrueWhenCurrentUserIsTheOwner() { var id = "1"; var usrname = "abcd"; User usr = new User { _id = id, username = usrname }; var mp = new ResponseWithContentBody <PackageHeader> { content = new PackageHeader() { _id = id, maintainers = new List <User> { usr } }, success = true }; var c = new Mock <IGregClient>(); c.Setup(x => x.ExecuteAndDeserializeWithContent <PackageHeader>(It.IsAny <HeaderDownload>())) .Returns(mp); var pc = new PackageManagerClient(c.Object, MockMaker.Empty <IPackageUploadBuilder>(), ""); var res = pc.DoesCurrentUserOwnPackage(new Package("1", "1", "2.0.4", "1"), usrname); Assert.IsTrue(res); }