public void ExecuteRecordsCount() { string exportConfigFilePath = "TestData/ExportConfig.json"; string schemaFilePath = "TestData/ContactSchemaWithOwner.xml"; var mockService = new Mock <IOrganizationService>(); var response = new FetchXmlToQueryExpressionResponse(); response.Results["Query"] = new QueryExpression(); mockService.Setup(a => a.Execute(It.IsAny <FetchXmlToQueryExpressionRequest>())) .Returns(response); using (var worker = new BackgroundWorker()) { worker.WorkerReportsProgress = true; using (DataGridView gridView = new DataGridView()) { FluentActions.Invoking(() => RecordCounterProcessor.ExecuteRecordsCount(exportConfigFilePath, schemaFilePath, mockService.Object, worker, gridView)) .Should() .Throw <NullReferenceException>(); } } mockService.Verify(a => a.Execute(It.IsAny <FetchXmlToQueryExpressionRequest>()), Times.Once); }
public void ExecuteRecordsCountNullDataGridView() { string exportConfigFilePath = "TestData/ExportConfig.json"; string schemaFilePath = "TestData/apointmentsSchema.xml"; var mockService = new Mock <IOrganizationService>(); using (BackgroundWorker worker = new BackgroundWorker()) { FluentActions.Invoking(() => RecordCounterProcessor.ExecuteRecordsCount(exportConfigFilePath, schemaFilePath, mockService.Object, worker, null)) .Should() .Throw <ArgumentNullException>(); } }