public CrudServiceFacts(ServiceFixture fixture) { this.fixture = fixture; this.service = this.fixture.ServiceProvider.GetService <ICrudService <MockEntity> >(); this.repositoryMock = this.fixture.ServiceProvider.GetService <Mock <IRepository <MockEntity> > >(); this.unitOfWorkMock = this.fixture.ServiceProvider.GetService <Mock <IUnitOfWork> >(); }
public LessonServiceFacts(ServiceFixture fixture) { this.fixture = fixture; this.service = this.fixture.ServiceProvider.GetService <ILessonService>(); this.lessonRepositoryMock = this.fixture.ServiceProvider.GetService <Mock <IRepository <Lesson> > >(); this.lessonAttendeeRepositoryMock = this.fixture.ServiceProvider.GetService <Mock <IRepository <LessonAttendee> > >(); this.unitOfWorkMock = this.fixture.ServiceProvider.GetService <Mock <IUnitOfWork> >(); }
public async Task GetMetricsWorksAsExpectedAsync(ScaleAction action, int currentWorkerCount, long targetCount) { var fixture = new ServiceFixture(action, currentWorkerCount); var service = fixture.ExternalScaleService; var response = await service.GetMetrics(fixture.GetMetricsRequest, fixture.ServerCallContext); Assert.Equal(targetCount, response.MetricValues.First().MetricValue_); }
public async Task IsActiveWorksAsExpectedAsync(bool inputKeepWorkersAlive, bool expectedIsAlive) { int inputCurrentWorkerCount = 1; var fixture = new ServiceFixture(ScaleAction.AddWorker, inputCurrentWorkerCount, inputKeepWorkersAlive); var service = fixture.ExternalScaleService; expectedIsAlive = true; // TODO remove this line once white list implemented. Assert.Equal(expectedIsAlive, (await service.IsActive(fixture.ScaleObjectRef, fixture.ServerCallContext)).Result); }
/// <summary> /// Init /// </summary> /// <param name="connectionStrong"></param> /// <exception cref="DatabaseException">Ignore.</exception> public void Init(string connectionStrong) { ServiceFixture serviceFixture = new ServiceFixture(); _database = serviceFixture.ServiceProvider.GetRequiredService <IDatabase>(); _database.InitializeAsync().Wait(); _transaction = serviceFixture.ServiceProvider.GetRequiredService <ITransaction>(); _transactionContext = _transaction.BeginTransactionAsync <Post>(System.Data.IsolationLevel.ReadUncommitted).Result; }
public CustomerServiceTest(ServiceFixture fixture) : base(fixture) { _customerRecords = new List <CustomerRecord> { new CustomerRecord { FirstName = "Mary", LastName = "Smith", }, new CustomerRecord { FirstName = "John", LastName = "McDonald", }, new CustomerRecord { FirstName = "Rob", LastName = "McDonald", }, new CustomerRecord { FirstName = "Markson", LastName = "McDonald", }, new CustomerRecord { FirstName = "Jake", LastName = "McDonald", }, new CustomerRecord { FirstName = "Mark", LastName = "McPhil", }, new CustomerRecord { FirstName = "Susan", LastName = "McDonald", }, }; Fixture.Db.AddRange(_customerRecords); }
public void TestService() { var fixture = new ServiceFixture <IMemoService, MemoService>(this); //BDD тест (сценарий) fixture.For() //Допустим (предусловия) .GivenNothing() //Когда (тестируемые действия) .When(async service => await service.CreateMemos(2)) //Тогда (проверка результатов) .ThenExpect <MemoId, UpdateMemo>(command => command.Document != null) .ThenExpect <MemoId, UpdateMemo>(command => command.Document != null); }
public MyFooServiceTest(ServiceFixture fixture) : base(fixture) { _myFooRecords = new List <MyFooRecord> { new MyFooRecord { FirstName = "Mary", LastName = "Smith", }, new MyFooRecord { FirstName = "John", LastName = "McDonald", } }; Fixture.Db.AddRange(_myFooRecords); }
/// <summary> /// PrepareDatabaseAsync /// </summary> /// <returns></returns> /// <exception cref="DatabaseException">Ignore.</exception> private static async System.Threading.Tasks.Task PrepareDatabaseAsync() { ServiceFixture serviceFixture = new ServiceFixture(); IDatabase database = serviceFixture.ServiceProvider.GetRequiredService <IDatabase>(); await database.InitializeAsync().ConfigureAwait(false); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 2000; ++i) { stringBuilder.Append('x'); } string text = stringBuilder.ToString(); List <Post> posts = new List <Post>(); for (int i = 0; i < 5001; i++) { Post newItem = new Post { Text = text, CreationDate = TimeUtil.UtcNowUnixTimeMilliseconds, LastChangeDate = TimeUtil.UtcNowUnixTimeMilliseconds }; posts.Add(newItem); } ITransaction transaction = serviceFixture.ServiceProvider.GetRequiredService <ITransaction>(); TransactionContext transactionContext = await transaction.BeginTransactionAsync <Post>().ConfigureAwait(false); try { await database.BatchAddAsync(posts, "", transactionContext).ConfigureAwait(false); await transaction.CommitAsync(transactionContext).ConfigureAwait(false); } catch { await transaction.RollbackAsync(transactionContext).ConfigureAwait(false); } }
public ProductServiceTest(ServiceFixture client) : base(client) { _productRecords = new List <ProductRecord> { new ProductRecord { ProductCode = "APP", ProductName = "Apple", ListPrice = 10.50m, IsListed = true, }, new ProductRecord { ProductCode = "BAN", ProductName = "Banana", ListPrice = 30.99m, IsListed = true, }, new ProductRecord { ProductCode = "ONG", ProductName = "Orange", ListPrice = 35.99m, IsListed = false, }, new ProductRecord { ProductCode = "STR", ProductName = "Strawberry", ListPrice = 40.00m, IsListed = true, }, }; Fixture.Db.AddRange(_productRecords); }
public ProductServiceTest(ServiceFixture client) : base(client) { _productRecords = new List <ProductRecord> { new ProductRecord { ProductCode = "APP", ProductName = "Apple", ListPrice = 10.50m, }, new ProductRecord { ProductCode = "BAN", ProductName = "Banana", ListPrice = 30.99m, }, }; Fixture.Db.AddRange(_productRecords); }
public DeleteSpending(ServiceFixture fixture) : base(fixture) { }
public GetTabs(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public OrderServiceTest(ServiceFixture fixture) : base(fixture) { _customerRecords = new List <CustomerRecord> { new CustomerRecord { FirstName = "Mary2", LastName = "Smith2", }, new CustomerRecord { FirstName = "John2", LastName = "McDonald2", }, new CustomerRecord { FirstName = "Jake2", LastName = "McDonald2", } }; Fixture.Db.AddRange(_customerRecords); _productRecords = new List <ProductRecord> { new ProductRecord { ProductCode = "APP2", ProductName = "Apple2", ListPrice = 102.50m, }, new ProductRecord { ProductCode = "BAN2", ProductName = "Banana2", ListPrice = 302.99m, }, new ProductRecord { ProductCode = "ORG2", ProductName = "Orange2", ListPrice = 102.50m, }, new ProductRecord { ProductCode = "MAN2", ProductName = "Mango2", ListPrice = 500.99m, }, }; Fixture.Db.AddRange(_productRecords); _orderRecords = new List <OrderRecord> { new OrderRecord { CustomerId = _customerRecords[0].Id, OrderStatusId = OrderStatus.Invoiced, OrderItems = new List <OrderItemRecord> { new OrderItemRecord { ProductId = _productRecords[0].Id, UnitPrice = _productRecords[0].ListPrice, Quantity = 30, StatusId = OrderItemStatus.NoStock, }, new OrderItemRecord { ProductId = _productRecords[1].Id, UnitPrice = _productRecords[1].ListPrice, Quantity = 60, StatusId = OrderItemStatus.OnOrder, }, }, }, new OrderRecord { CustomerId = _customerRecords[1].Id, OrderStatusId = OrderStatus.Shipped, OrderItems = new List <OrderItemRecord> { new OrderItemRecord { ProductId = _productRecords[1].Id, UnitPrice = _productRecords[1].ListPrice, Quantity = 40, StatusId = OrderItemStatus.Allocated, }, new OrderItemRecord { ProductId = _productRecords[2].Id, UnitPrice = _productRecords[2].ListPrice, Quantity = 50, StatusId = OrderItemStatus.Invoiced, }, }, }, }; Fixture.Db.AddRange(_orderRecords); }
public GetOrdersOfSpending(ServiceFixture fixture) : base(fixture) { }
public SettlementWorkflows(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public GetSettlement(ServiceFixture fixture) : base(fixture) { }
public PostProduct(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public GetConsumptionBetween(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public GetSettlements(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public GetProducts(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public ProfileServiceTestsBase(ServiceFixture serviceFixture) : base(serviceFixture) { ProfileService = GetService <IProfileService>(); }
public GetProduct(ServiceFixture fixture) : base(fixture) { }
public DeleteOrder(ServiceFixture fixture) : base(fixture) { }
public GetOrders(ServiceFixture fixture) : base(fixture) { }
public GetSpendings(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public PostSettleTabs(ServiceFixture fixture) : base(fixture) { DeleteStream(); }
public void Dispose() { TestFixture.Dispose(); ServiceFixture.Dispose(); }
public BbsBlsSignature2020SuiteTests(ServiceFixture serviceFixture) { Provider = serviceFixture.Provider; LdProofService = Provider.GetRequiredService <ILinkedDataProofService>(); }
public GetSpending(ServiceFixture fixture) : base(fixture) { }