public static TestAccountInfo GetTestAccount() { var account = ConfigDbServicesHelper.GetAccountService().GetOneOrNullBySystemName("TEST"); if (account == null) { throw new Exception("Тестовый аккаунт не существует"); } return(TestAccountInfo.Create(account)); }
public static Core.Api.ComponentInfo GetTestApplicationComponent(TestAccountInfo accountInfo) { var componentTypeId = CreateRandomComponentTypeId(accountInfo.Id); var data = new GetOrCreateComponentRequestData() { SystemName = "test component systemName", DisplayName = "test component dispay name", TypeId = componentTypeId, ParentComponentId = accountInfo.RootId }; var dispatcher = GetDispatcherClient(); var response = dispatcher.GetOrCreateComponent(accountInfo.Id, data); return(response.Data.Component); }
public static void CheckActualStatusEventsCount(TestAccountInfo account, Guid ownerId) { account.SaveAllCaches(); var now = GetDispatcherClient().GetServerTime().Data.Date.AddSeconds(1); using (var storageDbContext = AccountDbContext.CreateFromAccountId(account.Id)) { var events = storageDbContext.Events .Where(x => x.OwnerId == ownerId && x.ActualDate > now) .ToList(); var categoryGroups = events.GroupBy(x => x.Category); foreach (var categoryGroup in categoryGroups) { var categoryEvents = categoryGroup.ToArray(); Assert.Equal(1, categoryEvents.Length); } } }