Esempio n. 1
0
        public async Task ContextHanler_TC01()
        {
            // Arrange
            string testCase = "AltinnApps0001";

            XacmlContextRequest request = TestSetupUtil.CreateXacmlContextRequest(testCase);
            XacmlContextRequest expectedEnrichedRequest = TestSetupUtil.GetEnrichedRequest(testCase);

            // Act

            Instance    instance = TestSetupUtil.GetInstanceData("7dd3c208-0062-4ff6-9ef7-2384e9199a6c.json");
            List <Role> roles    = TestSetupUtil.GetRoles(1, 1000);

            _policyInformationRepositoryMock.Setup(p => p.GetInstance(It.Is <string>(s => s.Equals("1000/7dd3c208-0062-4ff6-9ef7-2384e9199a6c")))).ReturnsAsync(instance);
            _rolesMock.Setup(p => p.GetDecisionPointRolesForUser(It.Is <int>(s => s.Equals(1)), It.Is <int>(p => p.Equals(1000)))).ReturnsAsync(roles);

            XacmlContextRequest enrichedRequest = await _contextHandler.Enrich(request);


            // Assert
            Assert.NotNull(enrichedRequest);
            Assert.NotNull(expectedEnrichedRequest);
            AssertionUtil.AssertEqual(expectedEnrichedRequest, enrichedRequest);
        }
Esempio n. 2
0
        public async Task ContextHandler_TC01()
        {
            // Arrange
            string testCase = "AltinnApps0021";

            XacmlContextRequest request = TestSetupUtil.CreateXacmlContextRequest(testCase);
            XacmlContextRequest expectedEnrichedRequest = TestSetupUtil.GetEnrichedRequest(testCase);

            // Act
            XacmlContextRequest enrichedRequest = await _contextHandler.Enrich(request);

            // Assert
            Assert.NotNull(enrichedRequest);
            Assert.NotNull(expectedEnrichedRequest);
            AssertionUtil.AssertEqual(expectedEnrichedRequest, enrichedRequest);
        }