Exemplo n.º 1
0
        public void ToApiCreateRoomRequest()
        {
            // ARRANGE
            GroupMemberAcceptance paramGMA = GroupMemberAcceptance.AutoAllow;
            string expectedGMAValue        = "autoallow";

            ApiCreateRoomRequest expected = FactoryRoom.ApiCreateRoomRequest;

            expected.NewGroupMemberAcceptance = expectedGMAValue;

            CreateRoomRequest param = new CreateRoomRequest(expected.Name)
            {
                ParentId = expected.ParentId.Value,
                Quota    = expected.Quota,
                Notes    = expected.Notes,
                RecycleBinRetentionPeriod = expected.RecycleBinRetentionPeriod,
                HasInheritPermissions     = expected.InheritPermissions.Value,
                AdminUserIds             = expected.AdminIds,
                AdminGroupIds            = expected.AdminGroupIds,
                NewGroupMemberAcceptance = paramGMA
            };

            Mock.Arrange(() => EnumConverter.ConvertGroupMemberAcceptanceToValue(paramGMA)).Returns(expectedGMAValue);

            // ACT
            ApiCreateRoomRequest actual = RoomMapper.ToApiCreateRoomRequest(param);

            // ASSERT
            Assert.Equal(expected, actual, new ApiCreateRoomRequestComparer());
        }
        public void ConvertGroupMemberAcceptanceToValue(GroupMemberAcceptance?value, string expected)
        {
            // ARRANGE

            // ACT
            string actual = EnumConverter.ConvertGroupMemberAcceptanceToValue(value);

            // ASSERT
            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
        internal static ApiCreateRoomRequest ToApiCreateRoomRequest(CreateRoomRequest createRoomRequest)
        {
            ApiCreateRoomRequest apiCreateRoomRequest = new ApiCreateRoomRequest {
                ParentId = createRoomRequest.ParentId,
                Name     = createRoomRequest.Name,
                Quota    = createRoomRequest.Quota,
                Notes    = createRoomRequest.Notes,
                RecycleBinRetentionPeriod = createRoomRequest.RecycleBinRetentionPeriod,
                InheritPermissions        = createRoomRequest.HasInheritPermissions,
                AdminIds                 = createRoomRequest.AdminUserIds,
                AdminGroupIds            = createRoomRequest.AdminGroupIds,
                NewGroupMemberAcceptance = EnumConverter.ConvertGroupMemberAcceptanceToValue(createRoomRequest.NewGroupMemberAcceptance)
            };

            return(apiCreateRoomRequest);
        }