private void TrySortDate(NewUpdateFilter filter, bool sum = false)
        {
            filter.BeginDate = DateTime.Now.Date.AddDays(-4);
            var logs  = filter.Find(session);
            var count = logs.Count - 1;

            if (filter.SortDirection == "Desc")
            {
                for (int i = 0; i < count; i++)
                {
                    Assert.That(logs[i].CreatedOn, Is.GreaterThanOrEqualTo(logs[i++].CreatedOn));
                }
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    Assert.That(logs[i].CreatedOn, Is.LessThanOrEqualTo(logs[i++].CreatedOn));
                }
            }
            if (!sum)
            {
                filter.SortDirection = filter.SortDirection == "Desc" ? "Asc" : "Desc";
                TrySortDate(filter, true);
            }
        }
示例#2
0
        /// <summary>
        /// История обновлений для пользователей новой версии analit-f
        /// </summary>
        public void NewUpdateLog()
        {
            SetSmartBinder(AutoLoadBehavior.NullIfInvalidKey);
            //по умолчанию биндер будет пытаться проверить наши обекты, в данном контексте делать этого не следует
            Binder.Validator = null;

            var filter = new NewUpdateFilter();

            BindObjectInstance(filter, "filter");
            PropertyBag["filter"] = filter;

            PropertyBag["logEntities"] = filter.Find(DbSession);
        }
示例#3
0
        public void Connect_client_app_logs()
        {
            var user      = DataMother.CreateTestClientWithUser().Users[0];
            var clientLog = new ClientAppLog(user);

            clientLog.RequestToken = Guid.NewGuid().ToString();
            session.Save(clientLog);
            var requestLog = new RequestLog(user);

            requestLog.RequestToken = clientLog.RequestToken;
            session.Save(requestLog);

            var filter = new NewUpdateFilter {
                User = user
            };
            var logs = filter.Find(session);

            Assert.AreEqual(logs.Count, 1, logs.Implode());
            Assert.IsTrue(logs[0].HaveLog);
        }