Пример #1
0
        public async Task Insert(DbInsertContext context, LogScenarioStart logScenarioStart)
        {
            await Task.CompletedTask;

            context.Scenarios.Add(logScenarioStart);
            context.ScenarioNames = string.Join("/", context.Scenarios);
        }
Пример #2
0
        public async Task Insert(DbInsertContext context, LogAssert l)
        {
            var page = context.Page;

            page.HasAssert = true;
            await repository.UpdateAsync(page);

            context.Redirection.ToPageHasAssert = true;
            await repository.UpdateAsync(context.Redirection);
        }
Пример #3
0
 public async Task Insert(DbInsertContext context, LogEmailRead l)
 {
     await repository.InsertAsync(new TestEmailRead()
     {
         TestName      = context.TestName,
         IndexInTest   = context.IndexInTest,
         UserName      = context.UserName,
         ScenarioNames = context.ScenarioNames,
         EmailName     = l.MailMessage.Body.GetType().GetFriendlyName()
     });
 }
Пример #4
0
 public async Task Insert(DbInsertContext context, LogRepo l)
 {
     await repository.InsertAsync(new TestRepositoryOperation()
     {
         TestName      = context.TestName,
         IndexInTest   = context.IndexInTest,
         UserName      = context.UserName,
         ScenarioNames = context.ScenarioNames,
         PageName      = context.PageName,
         MessageName   = context.MessageName,
         EntityName    = l.EntityType.GetFriendlyName(),
         Operation     = l.Operation
     });
 }
Пример #5
0
        public async Task AddLogs(string userName, UserLog[] userLogs, Test test)
        {
            var context = new DbInsertContext()
            {
                TestName    = test.TestName,
                UserName    = userName,
                IndexInTest = 0
            };

            foreach (var o in userLogs)
            {
                await AddLog(o, context);
            }
        }
Пример #6
0
        public async Task Insert(DbInsertContext context, LogMessageBus l)
        {
            var messageName = l.Message.GetType().GetFriendlyName();
            await repository.InsertAsync(new TestMessage()
            {
                TestName      = context.TestName,
                IndexInTest   = context.IndexInTest,
                UserName      = context.UserName,
                ScenarioNames = context.ScenarioNames,
                PageName      = context.PageName,
                MessageName   = messageName
            });

            context.MessageName = messageName;
        }
Пример #7
0
        public async Task Insert(DbInsertContext context, LogScenarioEnd logScenarioEnd)
        {
            await Task.CompletedTask;

            if (context.Scenarios.Count == 0)
            {
                throw new Exception("Erreur d'algorithmique");
            }
            var lastScenario = context.Scenarios[context.Scenarios.Count - 1];

            if (lastScenario.ScenarioId != logScenarioEnd.ScenarioId)
            {
                throw new Exception("Erreur d'algorithmique");
            }

            context.Scenarios.RemoveAt(context.Scenarios.Count - 1);
            context.ScenarioNames = string.Join("/", context.Scenarios);
        }
Пример #8
0
        private async Task InsertPage(DbInsertContext context, IMessage pageQuery, TestPageRedirection redirection)
        {
            var page = new TestPage()
            {
                TestName      = context.TestName,
                IndexInTest   = context.IndexInTest + 1,
                UserName      = context.UserName,
                ScenarioNames = context.ScenarioNames,
                PageName      = pageQuery.GetType().GetFriendlyName(),
                PageUrl       = routeToUrl.ToParameterizedUrlShort(pageQuery)
            };

            await repository.InsertAsync(page);

            context.PageName       = page.PageName;
            context.Page           = page;
            context.Redirection    = redirection;
            context.PageMemberName = null;
            context.MessageName    = null;
        }
Пример #9
0
        public async Task Insert(DbInsertContext context, LogSubmitRedirect l)
        {
            var redirection = new TestPageRedirection()
            {
                TestName      = context.TestName,
                IndexInTest   = context.IndexInTest,
                UserName      = context.UserName,
                ScenarioNames = context.ScenarioNames,
                FromPageName  = context.PageName,
                ToPageName    = l.PageQuery.GetType().GetFriendlyName(),
                IsForm        = true,
                IsLink        = false,
                MemberName    = context.PageMemberName
            };

            await repository.InsertAsync(redirection);

            context.IndexInTest++;

            await InsertPage(context, l.PageQuery, redirection);
        }
Пример #10
0
        public async Task AddLog(UserLog o, DbInsertContext context)
        {
            if (o is LogAssert logAssert)
            {
                await dbPage.Insert(context, logAssert);
            }
            if (o is LogAsyncCall logAsyncCall)
            {
                await dbPage.Insert(context, logAsyncCall);
            }
            if (o is LogDisplay logDisplay)
            {
                await dbPage.Insert(context, logDisplay);
            }
            if (o is LogEmailRead logEmailRead)
            {
                await dbEmail.Insert(context, logEmailRead);
            }
            if (o is LogEmailSent logEmailSent)
            {
                await dbEmail.Insert(context, logEmailSent);
            }
            if (o is LogFollow logFollow)
            {
                await dbPage.Insert(context, logFollow);
            }
            if (o is LogMessageBus logMessageBus)
            {
                await dbMessage.Insert(context, logMessageBus);
            }
            if (o is LogRepo logRepo)
            {
                await dbEntity.Insert(context, logRepo);
            }
            if (o is LogScenarioStart logScenarioStart)
            {
                await dbScenario.Insert(context, logScenarioStart);
            }
            if (o is LogScenarioEnd logScenarioEnd)
            {
                await dbScenario.Insert(context, logScenarioEnd);
            }
            if (o is LogSubmit logSubmit)
            {
                await dbPage.Insert(context, logSubmit);
            }
            if (o is LogSubmitRedirect logSubmitRedirect)
            {
                await dbPage.Insert(context, logSubmitRedirect);
            }



            context.IndexInTest++;

            /*
             * if (o is LogFollow logFollow)
             * {
             *  var entity = new LogDbPage()
             *  {
             *      TestId = context.Test.Id,
             *      PageQuery = logFollow.PageQuery.GetType().Name,
             *      PageName = logFollow.PageResponse.GetType().Name,
             *  };
             *  await repository.InsertAsync(entity);
             * }
             * if (o is LogEmailRead logEmailRead)
             * {
             *  var entity = new LogDbEmailRead()
             *  {
             *      TestId = context.Test.Id,
             *      MessageName = logEmailRead.MailMessage.GetType().Name
             *
             *  };
             *  await repository.InsertAsync(entity);
             * }
             * if (o is LogEmailSend logEmailSend)
             * {
             *  var entity = new LogDbEmailRead()
             *  {
             *      TestId = context.Test.Id,
             *      MessageName = logEmailRead.MailMessage.GetType().Name
             *
             *  };
             *  await repository.InsertAsync(entity);
             * }
             */
        }
Пример #11
0
        public async Task Insert(DbInsertContext context, LogAsyncCall l)
        {
            await Task.CompletedTask;

            context.PageMemberName = l.MemberName;
        }