public void CheckOrganisationAccess_ReturnsFalse_WhenUserHasNoClaims() { // Arrange Guid organisationID = new Guid("5F3069F4-EDA3-43A3-BDD8-726028CDABB0"); IUserContext userContext = A.Fake <IUserContext>(); WeeeContext weeeContext = MakeFakeWeeeContext(userContext); WeeeAuthorization authorization = new WeeeAuthorization(weeeContext, userContext); // Act bool result = authorization.CheckOrganisationAccess(organisationID); // Assert Assert.Equal(false, result); }
public void CheckOrganisationAccess_ReturnsTrue_WhenUserHasRequiredClaims() { // Arrange Guid organisationID = new Guid("5F3069F4-EDA3-43A3-BDD8-726028CDABB0"); Guid userId = Guid.NewGuid(); IUserContext userContext = A.Fake <IUserContext>(); WeeeContext weeeContext = MakeFakeWeeeContext( userContext, userId, new List <OrganisationUser> { new OrganisationUser(userId, organisationID, UserStatus.Active) }); WeeeAuthorization authorization = new WeeeAuthorization(weeeContext, userContext); // Act bool result = authorization.CheckOrganisationAccess(organisationID); // Assert Assert.Equal(true, result); }
public void CheckOrganisationAccess_ReturnsTrue_WhenUserHasRequiredClaims() { // Arrange Guid organisationID = new Guid("5F3069F4-EDA3-43A3-BDD8-726028CDABB0"); Guid userId = Guid.NewGuid(); IUserContext userContext = A.Fake<IUserContext>(); WeeeContext weeeContext = MakeFakeWeeeContext( userContext, userId, new List<OrganisationUser> { new OrganisationUser(userId, organisationID, UserStatus.Active) }); WeeeAuthorization authorization = new WeeeAuthorization(weeeContext, userContext); // Act bool result = authorization.CheckOrganisationAccess(organisationID); // Assert Assert.Equal(true, result); }
public void CheckOrganisationAccess_ReturnsFalse_WhenUserHasNoClaims() { // Arrange Guid organisationID = new Guid("5F3069F4-EDA3-43A3-BDD8-726028CDABB0"); IUserContext userContext = A.Fake<IUserContext>(); WeeeContext weeeContext = MakeFakeWeeeContext(userContext); WeeeAuthorization authorization = new WeeeAuthorization(weeeContext, userContext); // Act bool result = authorization.CheckOrganisationAccess(organisationID); // Assert Assert.Equal(false, result); }