Пример #1
0
        public async Task SenderDataTable()
        {
            var dir = AppContext.BaseDirectory;

            #region arange

            var rows   = new List <IRow>();
            int nrRows = 10;
            for (int i = 0; i < nrRows; i++)
            {
                var rowAndrei = new Mock <IRow>();

                rowAndrei.SetupProperty(it => it.Values,
                                        new Dictionary <string, object>()
                {
                    ["ID"]        = i,
                    ["FirstName"] = "Andrei" + i,
                    ["LastName"]  = "Ignat" + i
                }
                                        );

                rows.Add(rowAndrei.Object);
            }


            #endregion
            #region act
            var send = new SenderDataTable();
            send.valuesToBeSent = rows.ToArray();
            await send.Send();

            #endregion
            #region assert
            var data = send.result;
            data.ShouldNotBeNull();
            data.Columns.Count.ShouldBe(3);
            data.Rows.Count.ShouldBe(nrRows);
            data.Rows[0][0].ShouldBe("0");
            #endregion
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (string.IsNullOrWhiteSpace(fileGenerated))
            {
                return(Page());
            }
            try
            {
                SimpleJob job = new SimpleJob();
                job.UnSerialize(fileGenerated);
                var sd = new SenderDataTable();
                job.AddSender(sd);
                await job.Execute();

                Result = sd.result;
                return(Page());
            }
            catch (Exception ex)
            {
                ExceptionMessage = ex.Message;
                return(Page());
            }
        }