public void ToneChat_Success_With_ToneChatInput() { IClient client = CreateClient(); #region response UtteranceAnalyses response = new UtteranceAnalyses() { UtterancesTone = new List <UtteranceAnalysis>() { new UtteranceAnalysis() { UtteranceId = "utteranceID", UtteranceText = "utteranceText", Tones = new List <ToneChatScore>() { new ToneChatScore() { ToneName = "string", ToneId = "string", Score = 0 } } } } }; #endregion ToneChatInput toneChatInput = new ToneChatInput() { Utterances = new List <Utterance>() { new Utterance() { Text = "utteranceText", User = "******" } } }; IRequest request = Substitute.For <IRequest>(); client.PostAsync(Arg.Any <string>()) .Returns(request); request.WithArgument(Arg.Any <string>(), Arg.Any <string>()) .Returns(request); request.WithHeader(Arg.Any <string>(), Arg.Any <string>()) .Returns(request); request.WithBody(Arg.Any <ToneChatInput>()) .Returns(request); request.As <UtteranceAnalyses>() .Returns(Task.FromResult(response)); ToneAnalyzerService service = new ToneAnalyzerService(client); service.VersionDate = versionDate; var result = service.ToneChat(toneChatInput); Assert.IsNotNull(result); client.Received().PostAsync(Arg.Any <string>()); Assert.IsTrue(result.UtterancesTone.Count >= 1); Assert.IsTrue(result.UtterancesTone[0].Tones.Count >= 1); Assert.IsTrue(result.UtterancesTone[0].Tones[0].ToneName == "string"); }