public void RunCustomerReportBatchShouldSendReports()
        {
            // Arrange
            var customerDataMock = new Mock<ICustomerData>();
            var reportBuilderMock = new Mock<IReportBuilder>();
            var emailerMock = new Mock<IEmailer>();

            var expectedCustomer = new Customer("[email protected]");
            var expectedReportBody = "the report body";

            customerDataMock.Setup(x => x.GetCustomersForCustomerReport())
                .Returns(new[] { expectedCustomer });

            reportBuilderMock.Setup(x => x.CreateCustomerReport(expectedCustomer))
                .Returns(new Report(expectedCustomer.Email, expectedReportBody));

            var sut = new ReportingService(
                customerDataMock.Object,
                reportBuilderMock.Object,
                emailerMock.Object);

            // Act
            sut.RunCustomerReportBatch();

            // Assert
            emailerMock.Verify(x => x.Send(expectedCustomer.Email, expectedReportBody));
        }
        public void SetUp()
        {
            Monitor.Enter(_locker);
            _embeddedReportingServer = new EmbeddedReportingServer(3000);
            _embeddedReportingServer.CleanServerData();
            _embeddedReportingServer.StartAsync().Wait();

            _reportingService = new ReportingService("http://localhost:3000");
        }
Example #3
0
        static void Main(string[] args)
        {
            var test = new _test_cshtml();
            var xrpt = test.TransformText();

            // Convert to byte[] for streaming etc:
            //var converter = new PdfReportConverter();
            //var buffer = converter.ConvertToBuffer(xrpt, "Test report");
            //Console.Write(buffer);

            var reportingService = new ReportingService();
            reportingService.OpenAsPdf(xrpt, "Test report");

            Console.Read();
        }
        /// <summary>
        /// SCORM Engine Service constructor that takes a single configuration parameter
        /// </summary>
        /// <param name="config">The Configuration object to be used to configure the Scorm Engine Service client</param>
        public ScormEngineService(Configuration config)
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            configuration = config;
            courseService = new CourseService(configuration, this);
            dispatchService = new DispatchService(configuration, this);
            registrationService = new RegistrationService(configuration, this);
            invitationService = new InvitationService(configuration, this);
            uploadService = new UploadService(configuration, this);
            ftpService = new FtpService(configuration, this);
            exportService = new ExportService(configuration, this);
            reportingService = new ReportingService(configuration, this);
            debugService = new DebugService(configuration, this);
        }
Example #5
0
        public static void Main()
        {
            var embededReportingServer = new EmbeddedReportingServer() { PingTimeout = new TimeSpan(0, 0, 100) };
            embededReportingServer.StartAsync().Wait();

            var reportingService = new ReportingService(embededReportingServer.EmbeddedServerUri);
            reportingService.SynchronizeTemplatesAsync().Wait();

            var rs = new ReportingService("http://localhost:2000");
            var r = rs.GetServerVersionAsync().Result;


            var result = rs.RenderAsync("Report1", null).Result;

            Console.WriteLine("Done");
            embededReportingServer.StopAsync().Wait();

        }
Example #6
0
        public static void Main()
        {
            //var embededReportingServer = new EmbeddedReportingServer();
            //embededReportingServer.StartAsync().Wait();

            //var reportingService = new ReportingService(embededReportingServer.EmbeddedServerUri);
            //reportingService.SynchronizeTemplatesAsync().Wait();


            //var settings = new ODataClientSettings { UrlBase = "http://localhost:1337/odata" };
            //var client = new ODataClient(settings);
            //var res = client.GetEntryAsync("users").Result;


            //http://localhost:1337/odata

            var rs = new ReportingService("http://localhost:4000", "admin", "password");

            Parallel.ForEach(Enumerable.Range(1, 1000), new ParallelOptions() {
                MaxDegreeOfParallelism = 3 }, i =>
            {
                Console.WriteLine(i);
                var rep = rs.RenderAsync("X1ltdPq7t", null).Result;
            });

            Console.WriteLine("Done");
            

            //rs.SynchronizeTemplatesAsync().Wait();
            //rs.SynchronizeTemplatesAsync().Wait();
            //rs.SynchronizeTemplatesAsync().Wait();


            //var result = rs.RenderAsync("Report1", null).Result;

            Console.WriteLine("Done");
            //embededReportingServer.StopAsync().Wait();
        }
        /// <summary>
        /// Represents the asynchronous entry point to the application, which allows us to use asynchorous methods.
        /// </summary>
        public static async Task MainAsync()
        {
            // Asks the user to specify a file name
            System.Console.Write("Specify file name (default is My Documents): ");
            string fileName = System.Console.ReadLine();
            if (string.IsNullOrWhiteSpace(fileName))
                fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Export.pdf");

            // Asks the user for his name
            System.Console.Write("What is your name: ");
            string documentAuthor = System.Console.ReadLine();

            // Creates the report, renders, and exports it
            System.Console.WriteLine("Generating document...");
            IIocContainer iocContainer = new SimpleIocContainer();
            ReportingService reportingService = new ReportingService(iocContainer);
            DocumentFormat documentFormat = Path.GetExtension(fileName).ToUpperInvariant() == ".XPS" ? DocumentFormat.Xps : DocumentFormat.Pdf;
            await reportingService.ExportAsync<Document>(documentFormat, fileName, string.IsNullOrWhiteSpace(documentAuthor) ? null : new { Author = documentAuthor });
            System.Console.WriteLine("Finished generating document");
            
            // Waits for a key stroke, before the application is quit
            System.Console.WriteLine("Press any key to quit...");
            System.Console.ReadKey();
        }
 /// <summary>
 /// Initializes a new <see cref="MainWindowViewModel"/> instance.
 /// </summary>
 /// <param name="reportingService">The reporting service, which is used to render reports using XAML.</param>
 public MainWindowViewModel(ReportingService reportingService)
 {
     this.reportingService = reportingService;
 }
Example #9
0
 public void getAllVisitsFromCurrentMonth()
 {
     var rs = new ReportingService();
     rs.GetVisitsFromCurrentMonth();
 }