internal async Task TestCreateAgentNotebookHandler() { using (SelfCleaningTempFile queryTempFile = new SelfCleaningTempFile()) { var service = new AgentService(); var connectionResult = await LiveConnectionHelper.InitLiveConnectionInfoAsync("master", queryTempFile.FilePath); AgentNotebookInfo notebook = AgentTestUtils.GetTestNotebookInfo("myTestNotebookJob" + Guid.NewGuid().ToString(), "master"); var createNotebookContext = new Mock <RequestContext <CreateAgentNotebookResult> >(); createNotebookContext.Setup(x => x.SendResult(It.IsAny <CreateAgentNotebookResult>())).Returns(Task.FromResult(new object())); await service.HandleCreateAgentNotebookRequest(new CreateAgentNotebookParams() { OwnerUri = connectionResult.ConnectionInfo.OwnerUri, Notebook = notebook, TemplateFilePath = AgentTestUtils.CreateTemplateNotebookFile() }, createNotebookContext.Object); createNotebookContext.Verify(x => x.SendResult(It.Is <CreateAgentNotebookResult>(p => p.Success == true))); Assert.Equal(true, AgentTestUtils.VerifyNotebook(connectionResult, notebook)); var createdNotebook = AgentTestUtils.GetNotebook(connectionResult, notebook.Name); await AgentTestUtils.CleanupNotebookJob(connectionResult, createdNotebook); } }