コード例 #1
0
        public void Should_Throw_Check_If_User_Is_Connected_After_Disconnect_Connect()
        {
            //arrange
            var server = new ChatServer();
            var user   = new User(String.Empty);

            server.Users.Add(user);

            //act
            server.Connect(user);
            server.Disconnect(user);
            server.Connect(user);
            var result = server.IsConnected(user);

            //assert
            result.ShouldBeEquivalentTo(true);
        }
コード例 #2
0
        public void Should_Not_Connect_To_Chat_Server()
        {
            //arrange
            var user   = new User(string.Empty);
            var server = new ChatServer();

            //act
            server.Connect(user);

            //assert
            user.IsConnected.ShouldBeEquivalentTo(false);
        }
コード例 #3
0
        public void Should_Disconnect_From_Chat_Server()
        {
            //arrange
            var user   = new User(string.Empty);
            var server = new ChatServer();

            server.Users.Add(user);
            server.Connect(user);

            //act
            server.Disconnect(user);

            //assert
            user.IsConnected.ShouldBeEquivalentTo(false);
        }
コード例 #4
0
        public void Should_Check_If_User_Is_Connected_False()
        {
            //arrange
            var server = new ChatServer();
            var user   = new User(String.Empty);

            server.Users.Add(user);
            server.Connect(user);

            var newUser = new User(string.Empty);

            //act
            var result = server.IsConnected(newUser);

            //assert
            result.ShouldBeEquivalentTo(false);
        }