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

                controller.MockCurrentIdentity
                .Setup(i => i.Name)
                .Returns("the-username");

                controller.GenerateApiKey();

                controller.MockUserService
                .Verify(s => s.GenerateApiKey("the-username"));
            }
コード例 #2
0
            public void RedirectsToAccountPage()
            {
                var controller = new TestableUsersController();

                controller.MockCurrentIdentity
                .Setup(i => i.Name)
                .Returns("the-username");

                var result = controller.GenerateApiKey() as RedirectToRouteResult;

                Assert.NotNull(result);
                Assert.Equal("Account", result.RouteValues["action"]);
                Assert.Equal("Users", result.RouteValues["controller"]);
            }
コード例 #3
0
            public void GeneratesAnApiKey()
            {
                var controller = new TestableUsersController();
                controller.MockCurrentIdentity
                          .Setup(i => i.Name)
                          .Returns("the-username");
                
                controller.GenerateApiKey();

                controller.MockUserService
                          .Verify(s => s.GenerateApiKey("the-username"));
            }
コード例 #4
0
            public void RedirectsToAccountPage()
            {
                var controller = new TestableUsersController();
                controller.MockCurrentIdentity
                          .Setup(i => i.Name)
                          .Returns("the-username");
                
                var result = controller.GenerateApiKey() as RedirectToRouteResult;

                Assert.NotNull(result);
                Assert.Equal("Account", result.RouteValues["action"]);
                Assert.Equal("Users", result.RouteValues["controller"]);
            }