public void addusertoachannel() { Channel channel1 = new Channel() { ChannelId = "5b8932523f0c56095c70d82d", ChannelName = "firstchannel", Users = new List <User> { }, Admin = new User { }, Messages = new List <Message> { }, WorkspaceId = "5b71298a6a2e663634872e65" }; User user1 = new User() { Id = "6c71298a6a2e663634872e61", UserId = "456", FirstName = "stack", LastName = "Route", EmailId = "*****@*****.**" }; FakeChatService fakechat = new FakeChatService(); ChatController _chatcontroller = new ChatController(fakechat); var result = _chatcontroller.AddUserToChannel(user1, "5b8932523f0c56095c70d82d"); var notePosted = result as ObjectResult; Assert.Equal(user1, notePosted.Value); }