public void createchannelinworkspace() { var putworkspace = new Workspace() { WorkspaceId = "5b71298a6a2e663634872a65", WorkspaceName = "dummyWorkspace", Channels = new List <Channel> { }, Users = new List <User> { } }; Channel channel1 = new Channel() { ChannelId = "5b8932523f0c56095c70d82d", ChannelName = "firstchannel", Users = new List <User> { }, Admin = new User { }, Messages = new List <Message> { }, WorkspaceId = null }; FakeChatService fakechat = new FakeChatService(); ChatController _chatcontroller = new ChatController(fakechat); var result = _chatcontroller.CreateChannelInWorkSpace(channel1, "5b71298a6a2e663634872a65"); var notePosted = result as ObjectResult; var channel = notePosted.Value as Channel; Assert.Equal("firstchannel", channel.ChannelName); }