コード例 #1
0
            public void WillReturn404IfTheCuratedFeedDoesNotExist()
            {
                var controller = new TestableCuratedPackagesController();

                var result = controller.GetCreateCuratedPackageForm("aWrongFeedName");

                Assert.IsType <HttpNotFoundResult>(result);
            }
コード例 #2
0
            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.GetCreateCuratedPackageForm("aFeedName");

                Assert.IsType <HttpNotFoundResult>(result);
            }
コード例 #3
0
            public void WillPushTheCuratedFeedNameIntoTheViewBag()
            {
                var controller = new TestableCuratedPackagesController();

                controller.StubCuratedFeed.Name = "theCuratedFeedName";

                var result = controller.GetCreateCuratedPackageForm("theCuratedFeedName") as ViewResult;

                Assert.NotNull(result);
                Assert.Equal("theCuratedFeedName", result.ViewBag.CuratedFeedName);
            }
コード例 #4
0
            public void WillReturn403IfTheCurrentUsersIsNotAManagerOfTheCuratedFeed()
            {
                var controller = new TestableCuratedPackagesController();

                controller.StubIdentity.Setup(stub => stub.Name).Returns("notAManager");

                var result = controller.GetCreateCuratedPackageForm("aFeedName") as HttpStatusCodeResult;

                Assert.NotNull(result);
                Assert.Equal(403, result.StatusCode);
            }
コード例 #5
0
            public void WillReturn403IfTheCurrentUsersIsNotAManagerOfTheCuratedFeed()
            {
                var controller = new TestableCuratedPackagesController();

                controller.SetCurrentUser(controller.Fakes.Owner);

                var result = controller.GetCreateCuratedPackageForm("aFeedName") as HttpStatusCodeResult;

                Assert.NotNull(result);
                Assert.Equal(403, result.StatusCode);
            }
コード例 #6
0
            public void WillPushTheCuratedFeedNameIntoTheViewBag()
            {
                var controller = new TestableCuratedPackagesController();
                controller.SetCurrentUser(controller.Fakes.User);
                controller.StubCuratedFeed.Name = "theCuratedFeedName";

                var result = controller.GetCreateCuratedPackageForm("theCuratedFeedName") as ViewResult;

                Assert.NotNull(result);
                Assert.Equal("theCuratedFeedName", result.ViewBag.CuratedFeedName);
            }
コード例 #7
0
            public void WillReturn403IfTheCurrentUsersIsNotAManagerOfTheCuratedFeed()
            {
                var controller = new TestableCuratedPackagesController();
                controller.SetCurrentUser(controller.Fakes.Owner);

                var result = controller.GetCreateCuratedPackageForm("aFeedName") as HttpStatusCodeResult;

                Assert.NotNull(result);
                Assert.Equal(403, result.StatusCode);
            }
コード例 #8
0
            public void WillReturn404IfTheCuratedFeedDoesNotExist()
            {
                var controller = new TestableCuratedPackagesController();
                controller.SetCurrentUser(controller.Fakes.User);

                var result = controller.GetCreateCuratedPackageForm("aWrongFeedName");

                Assert.IsType<HttpNotFoundResult>(result);
            }
コード例 #9
0
            public void WillReturn403IfTheCurrentUsersIsNotAManagerOfTheCuratedFeed()
            {
                var controller = new TestableCuratedPackagesController();
                controller.StubIdentity.Setup(stub => stub.Name).Returns("notAManager");

                var result = controller.GetCreateCuratedPackageForm("aFeedName") as HttpStatusCodeResult;

                Assert.NotNull(result);
                Assert.Equal(403, result.StatusCode);
            }