예제 #1
0
        /// <summary>
        /// This is a helper method to provide Tempdata context to the test
        /// </summary>
        public static TempDataDictionary AuthorizeApplication()
        {
            OAuthController controller = new OAuthController();

            controller.TempData = new TempDataDictionary();
            var result = controller.AuthorizeApplication() as ViewResult;

            return((TempDataDictionary)result.TempData);
        }
예제 #2
0
        public void TestAuthorizationWithCorrectKeys()
        {
            // Arrange
            OAuthController controller = new OAuthController();

            // Act
            ViewResult result = controller.AuthorizeApplication() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreNotEqual("Error", result.ViewName);
        }
예제 #3
0
        public void TestAuthorizationWithWrongorEmptyKeys()
        {
            // Arrange
            Mock <IConfigurationModel> configuration = TestHelper.GetMockedConfiguration();
            OAuthController            controller    = new OAuthController();

            controller.Configuration = configuration.Object;

            // Act
            ViewResult result = controller.AuthorizeApplication() as ViewResult;

            // Assert
            Assert.AreEqual("Error", result.ViewName);
        }