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 WriteDataToCSVNullPath()
        {
            IEnumerable <string> items = new List <string>();

            FluentActions.Invoking(() => RecordCounterProcessor.WriteDataToCSV(items, null))
            .Should()
            .Throw <ArgumentNullException>();
        }
        public void WriteDataToCSVNullItems()
        {
            IEnumerable <string> items = null;
            var path = "TestData/apointmentsSchema.xml";

            FluentActions.Invoking(() => RecordCounterProcessor.WriteDataToCSV(items, path))
            .Should()
            .Throw <ArgumentNullException>();
        }
        public void WriteDataToCSV()
        {
            var items = new List <string>();

            var path = "TestData/apointmentsSchema.xml";

            FluentActions.Invoking(() => RecordCounterProcessor.WriteDataToCSV(items, path))
            .Should()
            .NotThrow();
        }
        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>();
            }
        }