public void GetIdentitiesWithNoIdentitiesPropertiesFromAuthorizationContextReturnsNull() { var properties = new Dictionary <string, object>(); AuthorizationContext authContext = new FakeAuthorizationContext(properties); ReadOnlyCollection <IAuthorizationPolicy> authorizationPolicies = new ReadOnlyCollection <IAuthorizationPolicy>(new IAuthorizationPolicy[] { }); ServiceSecurityContext context = new ServiceSecurityContext(authContext, authorizationPolicies); IList <IIdentity> identities = context.GetIdentities(); Assert.Null(identities); }
public void GetIdentitiesReturnsTheIdentitiesPropertyThatWasSuppliedToTheAuthorizationContext() { var suppliedIdentityList = new List <IIdentity>(); var properties = new Dictionary <string, object> { ["Identities"] = suppliedIdentityList }; AuthorizationContext authContext = new FakeAuthorizationContext(properties); ReadOnlyCollection <IAuthorizationPolicy> authorizationPolicies = new ReadOnlyCollection <IAuthorizationPolicy>(new IAuthorizationPolicy[] { }); ServiceSecurityContext context = new ServiceSecurityContext(authContext, authorizationPolicies); IList <IIdentity> identities = context.GetIdentities(); Assert.Same(suppliedIdentityList, identities); }