public void UsesAuthorizationTest()
        {
            var mockAuthorizer = MockRepository.GenerateMock<IAuthorizer>();
            mockAuthorizer.Stub(x => x.IsAuthorized("Token1")).Return(true);

            var testUser = new UsesAuthorization(mockAuthorizer);
            string result = testUser.AccessAuthorizedResource();
            Assert.That(result, Is.EqualTo("Authorized Resource"));
        }
Пример #2
0
        public void UsesAuthorizationTest()
        {
            var mockAuthorizer = MockRepository.GenerateMock <IAuthorizer>();

            mockAuthorizer.Stub(x => x.IsAuthorized("Token1")).Return(true);

            var    testUser = new UsesAuthorization(mockAuthorizer);
            string result   = testUser.AccessAuthorizedResource();

            Assert.That(result, Is.EqualTo("Authorized Resource"));
        }