Ejemplo n.º 1
0
        public void IsSubscribed_ReturnsFalseIfUserDoesNotHaveAllSubscriptionPolicies()
        {
            // Arrange.
            var service      = new TestSecurityPolicyService();
            var user         = new User("testUser");
            var subscription = service.Mocks.Subscription.Object;

            user.SecurityPolicies.Add(subscription.Policies.First());

            // Act & Assert.
            Assert.False(service.IsSubscribed(user, service.UserSubscriptions.First()));
        }
Ejemplo n.º 2
0
        public void IsSubscribed_ReturnsTrueIfUserHasSubscriptionPolicies()
        {
            // Arrange.
            var service      = new TestSecurityPolicyService();
            var user         = new User("testUser");
            var subscription = service.Mocks.Subscription.Object;

            user.SecurityPolicies = subscription.Policies.ToList();

            // Act & Assert.
            Assert.True(service.IsSubscribed(user, service.UserSubscriptions.Single()));
        }
Ejemplo n.º 3
0
        public void IsSubscribed_ReturnsTrueIfUserHasSubscriptionAndOtherPolicies()
        {
            // Arrange.
            var service = new TestSecurityPolicyService();
            var user    = new User("testUser");

            user.SecurityPolicies.Add(new UserSecurityPolicy("OtherPolicy", "OtherSubscription"));
            var subscription = service.Mocks.Subscription.Object;

            foreach (var policy in subscription.Policies)
            {
                user.SecurityPolicies.Add(policy);
            }

            // Act & Assert.
            Assert.True(service.IsSubscribed(user, service.UserSubscriptions.First()));
        }