当前位置: 首页>>代码示例>>C#>>正文


C# ChatService.KickUser方法代码示例

本文整理汇总了C#中JabbR.Services.ChatService.KickUser方法的典型用法代码示例。如果您正苦于以下问题:C# ChatService.KickUser方法的具体用法?C# ChatService.KickUser怎么用?C# ChatService.KickUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JabbR.Services.ChatService的用法示例。


在下文中一共展示了ChatService.KickUser方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThrowsIfUserIsNotOwner

            public void ThrowsIfUserIsNotOwner()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                };

                user.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(user);
                room.Users.Add(user2);

                var service = new ChatService(repository);

                Assert.Throws<InvalidOperationException>(() => service.KickUser(user, user2, room));
            }
开发者ID:kiliman,项目名称:JabbR,代码行数:29,代码来源:ChatServiceFacts.cs

示例2: DoesNotThrowIfCreatorKicksOwner

            public void DoesNotThrowIfCreatorKicksOwner()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                    Creator = user
                };
                user.OwnedRooms.Add(room);
                room.Owners.Add(user);

                user2.OwnedRooms.Add(room);
                room.Owners.Add(user2);

                user.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(user);
                room.Users.Add(user2);

                var service = new ChatService(repository);

                service.KickUser(user, user2, room);

                Assert.False(user2.Rooms.Contains(room));
                Assert.False(room.Users.Contains(user2));
            }
开发者ID:kiliman,项目名称:JabbR,代码行数:38,代码来源:ChatServiceFacts.cs

示例3: ThrowsIfKickSelf

            public void ThrowsIfKickSelf()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };
                repository.Add(user);
                var room = new ChatRoom
                {
                    Name = "Room",
                    Creator = user
                };
                room.Owners.Add(user);
                user.OwnedRooms.Add(room);
                user.Rooms.Add(room);
                room.Users.Add(user);

                var service = new ChatService(repository);

                Assert.Throws<InvalidOperationException>(() => service.KickUser(user, user, room));
            }
开发者ID:kiliman,项目名称:JabbR,代码行数:22,代码来源:ChatServiceFacts.cs

示例4: ThrowsIfUserIsNotOwnerAndNotAdmin

            public void ThrowsIfUserIsNotOwnerAndNotAdmin()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                };

                user.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(user);
                room.Users.Add(user2);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                Assert.Throws<HubException>(() => service.KickUser(user, user2, room));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:29,代码来源:ChatServiceFacts.cs

示例5: ThrowsIfOwnerTriesToRemoveOwner

            public void ThrowsIfOwnerTriesToRemoveOwner()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                };
                user.OwnedRooms.Add(room);
                room.Owners.Add(user);

                user2.OwnedRooms.Add(room);
                room.Owners.Add(user2);

                user.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(user);
                room.Users.Add(user2);

                var service = new ChatService(repository, new Mock<ICryptoService>().Object);

                Assert.Throws<InvalidOperationException>(() => service.KickUser(user, user2, room));
            }
开发者ID:Polows,项目名称:JabbR,代码行数:34,代码来源:ChatServiceFacts.cs

示例6: ThrowsIfOwnerTriesToRemoveAdmin

            public void ThrowsIfOwnerTriesToRemoveAdmin()
            {
                var repository = new InMemoryRepository();
                var admin = new ChatUser
                {
                    Name = "foo",
                    IsAdmin = true
                };

                var owner = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(admin);
                repository.Add(owner);
                var room = new ChatRoom
                {
                    Name = "Room",
                };

                owner.OwnedRooms.Add(room);
                room.Owners.Add(owner);

                admin.Rooms.Add(room);
                owner.Rooms.Add(room);
                room.Users.Add(admin);
                room.Users.Add(owner);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                Assert.Throws<HubException>(() => service.KickUser(owner, admin, room));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:33,代码来源:ChatServiceFacts.cs

示例7: ThrowsIfTargetUserNotInRoom

            public void ThrowsIfTargetUserNotInRoom()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                    Creator = user
                };
                user.OwnedRooms.Add(room);
                room.Owners.Add(user);
                user.Rooms.Add(room);
                room.Users.Add(user);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                Assert.Throws<HubException>(() => service.KickUser(user, user2, room));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:29,代码来源:ChatServiceFacts.cs

示例8: DoesNotThrowIfAdminKicksOwner

            public void DoesNotThrowIfAdminKicksOwner()
            {
                var repository = new InMemoryRepository();
                var admin = new ChatUser
                {
                    Name = "foo",
                    IsAdmin = true
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(admin);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room"
                };

                user2.OwnedRooms.Add(room);
                room.Owners.Add(user2);

                admin.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(admin);
                room.Users.Add(user2);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                service.KickUser(admin, user2, room);

                Assert.False(user2.Rooms.Contains(room));
                Assert.False(room.Users.Contains(user2));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:36,代码来源:ChatServiceFacts.cs

示例9: AdminCanKickCreator

            public void AdminCanKickCreator()
            {
                var repository = new InMemoryRepository();
                var admin = new ChatUser
                {
                    Name = "foo",
                    IsAdmin = true
                };

                var creator = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(admin);
                repository.Add(creator);

                var room = new ChatRoom
                {
                    Name = "Room",
                    Creator = creator
                };

                creator.OwnedRooms.Add(room);
                room.Owners.Add(creator);

                admin.Rooms.Add(room);
                creator.Rooms.Add(room);
                room.Users.Add(admin);
                room.Users.Add(creator);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                service.KickUser(admin, creator, room);

                Assert.False(creator.Rooms.Contains(room));
                Assert.False(room.Users.Contains(creator));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:38,代码来源:ChatServiceFacts.cs

示例10: AdminCanKickAdmin

            public void AdminCanKickAdmin()
            {
                var repository = new InMemoryRepository();
                var admin = new ChatUser
                {
                    Name = "foo",
                    IsAdmin = true
                };

                var otherAdmin = new ChatUser
                {
                    Name = "foo2",
                    IsAdmin = true
                };

                repository.Add(admin);
                repository.Add(otherAdmin);

                var room = new ChatRoom
                {
                    Name = "Room"
                };

                admin.Rooms.Add(room);
                otherAdmin.Rooms.Add(room);
                room.Users.Add(admin);
                room.Users.Add(otherAdmin);

                var service = new ChatService(new Mock<ICache>().Object, repository);

                service.KickUser(admin, otherAdmin, room);

                Assert.False(otherAdmin.Rooms.Contains(room));
                Assert.False(room.Users.Contains(otherAdmin));
            }
开发者ID:QuickenLoans,项目名称:JabbR,代码行数:35,代码来源:ChatServiceFacts.cs

示例11: AdminCanKickUser

            public void AdminCanKickUser()
            {
                var repository = new InMemoryRepository();
                var admin = new ChatUser
                {
                    Name = "foo",
                    IsAdmin = true
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(admin);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                };

                admin.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(admin);
                room.Users.Add(user2);

                var service = new ChatService(repository, new Mock<ICryptoService>().Object);

                service.KickUser(admin, user2, room);

                Assert.False(user2.Rooms.Contains(room));
                Assert.False(room.Users.Contains(user2));
            }
开发者ID:osbornm,项目名称:JabbR,代码行数:33,代码来源:ChatServiceFacts.cs

示例12: ThrowsIfOwnerTriesToRemoveOwner

            public void ThrowsIfOwnerTriesToRemoveOwner()
            {
                var repository = new InMemoryRepository();
                var user = new ChatUser
                {
                    Name = "foo"
                };

                var user2 = new ChatUser
                {
                    Name = "foo2"
                };

                repository.Add(user);
                repository.Add(user2);
                var room = new ChatRoom
                {
                    Name = "Room",
                };
                user.OwnedRooms.Add(room);
                room.Owners.Add(user);

                user2.OwnedRooms.Add(room);
                room.Owners.Add(user2);

                user.Rooms.Add(room);
                user2.Rooms.Add(room);
                room.Users.Add(user);
                room.Users.Add(user2);

                var service = new ChatService(new Mock<ICache>().Object, new Mock<IRecentMessageCache>().Object, repository);

                Assert.Throws<HubException>(() => service.KickUser(user, user2, room));
            }
开发者ID:QuinntyneBrown,项目名称:JabbR,代码行数:34,代码来源:ChatServiceFacts.cs


注:本文中的JabbR.Services.ChatService.KickUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。