public void WillReturn404IfTheCuratedFeedDoesNotExist() { var controller = new TestableCuratedPackagesController(); var result = controller.DeleteCuratedPackage("aStrangeCuratedFeedName", "anId"); Assert.IsType <HttpNotFoundResult>(result); }
public void WillReturn404IfTheCuratedFeedDoesNotExist() { var controller = new TestableCuratedPackagesController(); var result = controller.DeleteCuratedPackage("aStrangeCuratedFeedName", "anId"); Assert.IsType<HttpNotFoundResult>(result); }
public void WillReturn204AfterDeletingTheCuratedPackage() { var controller = new TestableCuratedPackagesController(); var result = controller.DeleteCuratedPackage("aCuratedFeedName", "aCuratedPackageId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(204, result.StatusCode); }
public async Task WillReturn404IfTheCuratedFeedDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(controller.Fakes.User); var result = await controller.DeleteCuratedPackage("aStrangeCuratedFeedName", "anId"); Assert.IsType<HttpNotFoundResult>(result); }
public void WillReturn404IfTheCuratedPackageDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Packages = new[] { new CuratedPackage { PackageRegistration = new PackageRegistration() } }; var result = controller.DeleteCuratedPackage("aFeedName", "aStrangeCuratedPackageId"); Assert.IsType<HttpNotFoundResult>(result); }
public async Task WillReturn404IfTheCuratedFeedDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(controller.Fakes.User); var result = await controller.DeleteCuratedPackage("aStrangeCuratedFeedName", "anId"); Assert.IsType <HttpNotFoundResult>(result); }
public void WillReturn404IfTheCuratedFeedDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeedByNameQry.Setup(stub => stub.Execute(It.IsAny <string>(), It.IsAny <bool>())).Returns((CuratedFeed)null); var result = controller.DeleteCuratedPackage("aCuratedFeedName", "aCuratedPackageId"); Assert.IsType <HttpNotFoundResult>(result); }
public void WillReturn404IfTheCuratedPackageDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Packages = new[] { new CuratedPackage { PackageRegistration = new PackageRegistration() } }; var result = controller.DeleteCuratedPackage("aFeedName", "aStrangeCuratedPackageId"); Assert.IsType <HttpNotFoundResult>(result); }
public void WillReturn403IfTheCuratedPackageDoesNotExist() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Managers = new[] { new User { Username = "******" } }; var result = controller.DeleteCuratedPackage("aCuratedFeedName", "aCuratedPackageId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(403, result.StatusCode); }
public void WillDeleteTheCuratedPackageWhenRequestIsValid() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Key = 42; controller.StubCuratedFeed.Packages = new[] { new CuratedPackage { Key = 1066, PackageRegistration = new PackageRegistration { Id = "theCuratedPackageId" } } }; controller.DeleteCuratedPackage("theCuratedFeedName", "theCuratedPackageId"); controller.StubDeleteCuratedPackageCmd.Verify(stub => stub.Execute( 42, 1066)); }
public void WillReturn204AfterDeletingTheCuratedPackage() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(204, result.StatusCode); }
public async Task WillReturn403IfTheUserNotAManager() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(controller.Fakes.Owner); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = await controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(403, result.StatusCode); }
public void WillDeleteTheCuratedPackageWhenRequestIsValid() { var controller = new TestableCuratedPackagesController(); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); Assert.True(controller.EntitiesContext.CuratedPackages.Any (cp => cp.PackageRegistration.Id == "anId")); controller.DeleteCuratedPackage("aFeedName", "anId"); Assert.False(controller.EntitiesContext.CuratedPackages.Any (cp => cp.PackageRegistration.Id == "anId")); }
public void WillReturn403IfTheUserNotAManager() { var controller = new TestableCuratedPackagesController(); controller.StubIdentity .Setup(i => i.Name) .Returns("notAManager"); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(403, result.StatusCode); }
public async Task WillDeleteTheCuratedPackageWhenRequestIsValid() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(controller.Fakes.User); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration , PackageRegistrationKey = controller.StubPackageRegistration.Key, }); Assert.True(controller.EntitiesContext.CuratedPackages.Any (cp => cp.PackageRegistration.Id == "anId")); await controller.DeleteCuratedPackage("aFeedName", "anId"); Assert.False(controller.EntitiesContext.CuratedPackages.Any (cp => cp.PackageRegistration.Id == "anId")); }
public async Task WillReturn403IfTheUserNotAManager() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(controller.Fakes.Owner); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = await controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(403, result.StatusCode); }
public void WillReturn403IfTheUserNotAManager() { var controller = new TestableCuratedPackagesController(); controller.StubIdentity .Setup(i => i.Name) .Returns("notAManager"); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(403, result.StatusCode); }
public void WillReturn204AfterDeletingTheCuratedPackage() { var controller = new TestableCuratedPackagesController(); controller.SetCurrentUser(Fakes.User); controller.StubCuratedFeed.Packages.Add( new CuratedPackage { CuratedFeed = controller.StubCuratedFeed, CuratedFeedKey = controller.StubCuratedFeed.Key, PackageRegistration = controller.StubPackageRegistration, PackageRegistrationKey = controller.StubPackageRegistration.Key, }); var result = controller.DeleteCuratedPackage("aFeedName", "anId") as HttpStatusCodeResult; Assert.NotNull(result); Assert.Equal(204, result.StatusCode); }