コード例 #1
0
        public void setup_session_to_return_aggregate_with_requested_permission(UserAggregate agg, PermissionAggregate permAgg)
        {
            SessionCommitWasCalled = false;

            var input = new RequestUserPermissionsDTO
            {
                ForId    = agg.Id,
                ById     = agg.Id,
                Requests = new Dictionary <Guid, PermissionDetails>
                {
                    {
                        permAgg.Id, new PermissionDetails
                        {
                            Reason = "testReason"
                        }
                    }
                }
            };

            agg.UserRequestedPermissions(new List <PermissionAggregate> {
                permAgg
            }, input);

            SessionMock.Setup(a => a.Get <UserAggregate>(It.IsAny <Guid>(), It.IsAny <int?>(), It.IsAny <CancellationToken>()))
            .Callback(() =>
            {
                SessionGetWasCalled = true;
            })
            .Returns(Task.FromResult(agg));
        }