public async Task AddDynamoContext_LocalMode_AddsDynamoClientToServices() { this.contextOptionsMock .SetupGet(o => o.Profile) .Returns("ApplicationDevelopment"); this.contextOptionsMock .SetupGet(o => o.LocalMode) .Returns(false); this.contextOptionsMock .SetupGet(o => o.RegionEndpoint) .Returns(RegionEndpoint.APNortheast1); await TestRetrier.RetryAsync(() => { services.AddDynamoContext <FakeDynamoContext>(this.configurationMock.Object); Assert.Contains(this.services, s => s.ServiceType == typeof(IAmazonDynamoDB) && s.ImplementationType == typeof(AmazonDynamoDBClient)); }); }
public async Task AddDynamoContext_InvokesOnConfiguring() { this.contextOptionsMock .SetupGet(o => o.Profile) .Returns("ApplicationDevelopment"); this.contextOptionsMock .SetupGet(o => o.LocalMode) .Returns(false); this.contextOptionsMock .SetupGet(o => o.RegionEndpoint) .Returns(RegionEndpoint.APNortheast1); await TestRetrier.RetryAsync(() => { FakeDynamoContext.OnConfiguringInvoked = false; services.AddDynamoContext <FakeDynamoContext>(this.configurationMock.Object); Assert.True(FakeDynamoContext.OnConfiguringInvoked); }); }
public async Task AddDynamoContext_AddsContextToServicesAsSingleton() { this.contextOptionsMock .SetupGet(o => o.Profile) .Returns("ApplicationDevelopment"); this.contextOptionsMock .SetupGet(o => o.LocalMode) .Returns(false); this.contextOptionsMock .SetupGet(o => o.RegionEndpoint) .Returns(RegionEndpoint.APNortheast1); await TestRetrier.RetryAsync(() => { services.AddDynamoContext <FakeDynamoContext>(this.configurationMock.Object); Assert.Contains(this.services, s => s.ImplementationType == typeof(FakeDynamoContext) && s.Lifetime == ServiceLifetime.Singleton); }); }
public async Task CreateTableAsync_NoConfiguration_ThrowsExceptionWithCorrectMessage() { await TestRetrier.RetryAsync(async() => { var expected = string.Format( ExceptionMessage.EntityConfigurationNotFound, typeof(FakeEntity).FullName); var actual = default(string); try { await this.creator.CreateTableAsync( typeof(FakeDynamoContext), typeof(FakeEntity), TableName); } catch (Exception ex) { actual = ex.Message; } Assert.Equal(expected, actual); }); }
public async Task AddDynamoContext_AddsAwsOptionsToServiceProvider() { this.contextOptionsMock .SetupGet(o => o.Profile) .Returns("ApplicationDevelopment"); this.contextOptionsMock .SetupGet(o => o.LocalMode) .Returns(false); this.contextOptionsMock .SetupGet(o => o.RegionEndpoint) .Returns(RegionEndpoint.APNortheast1); await TestRetrier.RetryAsync(() => { services.AddDynamoContext <FakeDynamoContext>(this.configurationMock.Object); var serviceProvider = this.services.BuildServiceProvider(); var awsOptions = serviceProvider.GetService <AWSOptions>(); Assert.NotNull(awsOptions); }); }
public async Task CreateTableAsync_ResponseFail_ThrowsException() { await TestRetrier.RetryAsync(async() => { this.modelBuilder.Entity <FakeDynamoContext, FakeEntity>(entity => { entity.HasPrimaryKey(e => e.Id); }); this.clientMock .Setup(cli => cli.CreateTableAsync( It.IsAny <CreateTableRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new CreateTableResponse { HttpStatusCode = System.Net.HttpStatusCode.BadRequest }); await Assert.ThrowsAsync <DynamoContextConfigurationException>( () => this.creator.CreateTableAsync( typeof(FakeDynamoContext), typeof(FakeEntity), TableName)); }); }
public async Task CreateTableAsync_ResponseSuccess_ReturnsCorrectTableName() { await TestRetrier.RetryAsync(async() => { this.modelBuilder.Entity <FakeDynamoContext, FakeEntity>(entity => { entity.HasPrimaryKey(e => e.Id); }); this.clientMock .Setup(cli => cli.CreateTableAsync( It.IsAny <CreateTableRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new CreateTableResponse { HttpStatusCode = System.Net.HttpStatusCode.OK }); var result = await this.creator.CreateTableAsync( typeof(FakeDynamoContext), typeof(FakeEntity), TableName); Assert.Equal(TableName, result); }); }
public async Task CreateTableAsync_ValidInput_CallClientWithCorrectAttributeDefinitions() { await TestRetrier.RetryAsync(async() => { var definitions = new List <AttributeDefinition>(); this.modelBuilder.Entity <FakeDynamoContext, FakeEntity>(entity => { entity.HasPrimaryKey(e => e.Id); }); this.clientMock .Setup(cli => cli.CreateTableAsync( It.IsAny <CreateTableRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new CreateTableResponse { HttpStatusCode = System.Net.HttpStatusCode.OK }); this.attributeDefinitionFactoryMock .Setup(f => f.CreateAttributeDefinitions( It.IsAny <string>(), It.IsAny <ScalarAttributeType>(), It.IsAny <IEnumerable <GlobalSecondaryIndexConfiguration> >())) .Returns(definitions); await this.creator.CreateTableAsync( typeof(FakeDynamoContext), typeof(FakeEntity), TableName); this.clientMock .Verify(cli => cli.CreateTableAsync( It.Is <CreateTableRequest>(r => r.AttributeDefinitions == definitions), It.IsAny <CancellationToken>())); }); }
public async Task AddDynamoContext_ValidOptions_ContextAddedTwice_ThrowsException() { await TestRetrier.RetryAsync(() => { services.AddDynamoContext <FakeDynamoContext>( this.configurationMock.Object, options => { options.Profile = "ApplicationDevelopment"; options.LocalMode = false; options.RegionEndpoint = RegionEndpoint.APNortheast1; }); Assert.Throws <DynamoContextConfigurationException>( () => services.AddDynamoContext <FakeDynamoContext>( this.configurationMock.Object, options => { options.Profile = "ApplicationDevelopment"; options.LocalMode = false; options.RegionEndpoint = RegionEndpoint.APNortheast1; })); }); }
public void VerifyCollateralizationRatioTest_sm() { TestRetrier.RunWithRetry(MainPageBb.VerifyCollateralizationRatio, 3, TestReInitialize); }
public void VerifyAprOnHistoryOrderTest_sm() { TestRetrier.RunWithRetry(MainPageBb.VerifyAprOnHistoryOrder, 3, TestReInitialize); }
public void LendToLiquidityPoolTest_pm() { TestRetrier.RunWithRetry(MainPageCompaund.VerifyTokenCanbeLendedtoLiquidityPool, 3, TestReInitialize); }
public void BorrowFromLiquidityPoolTest_sk() { TestRetrier.RunWithRetry(MainPageCompaund.VerifyTokenCanbeBorrowedFromLiquidityPool, 3, TestReInitialize); }
public void TokenItemsDisplayLendPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyTokenItemsareDisplayedontheLendPage, 3, TestReInitialize); }
public void VerifyColumnsDisplayinLendPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyColumnsDisplayinLendPage, 3, TestReInitialize); }
public void UsdDisplayinAmountLendPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyUsdDisplayingLendPage, 3, TestReInitialize); }
public void ColumnDisplayinBorrowPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyCOlumnsDisplayinBorrowPage, 3, TestReInitialize); }
public void TokenDisplayinAmountBorrowPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyTokenDisplayinAmountBorrowPage, 3, TestReInitialize); }
public void PercentageIconDisplayLendPage_sk() { TestRetrier.RunWithRetry(MainPageBb.VerifyPercentageIconDisplayinLiquidityPoolLendPage, 3, TestReInitialize); }
public void OfferMyOwnREPBorrowTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyNewRepBorrowRequestCanBeCreated, 3, TestReInitialize); }
public void WithdrawFromLiquidityPoolTest_pm() { TestRetrier.RunWithRetry(MainPageCompaund.VerifyTokenCanbeWithdrawnedFromLiquidityPool, 3, TestReInitialize); }
public void CancelRequestTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyRequestCanbeCancelled, 3, TestReInitialize); }
public void RepayFromLiquidityPoolTest_sm() { TestRetrier.RunWithRetry(MainPageCompaund.VerifyTokenCanbeRepaidFromLiquidityPool, 3, TestReInitialize); }
public void LendRequestTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyRequestCanBeLended, 3, TestReInitialize); }
public void VerifyLtvOnJustCreatedOrderTest_sm() { TestRetrier.RunWithRetry(MainPageBb.VerifyLtvOnJustCreatedOrder, 3, TestReInitialize); }
public void RepayFunctionalityTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyRepayFunctionality, 3, TestReInitialize); }
public void VerifyAprOnJustCreatedOrderTest_sm() { TestRetrier.RunWithRetry(MainPageBb.VerifyAPRCalculationOnJustCreatedOrder, 3, TestReInitialize); }
public void ReturnCollateralTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyCollatrealCanbeReturned, 3, TestReInitialize); }
public void VerifyRepayCalculationTest_sm() { TestRetrier.RunWithRetry(MainPageBb.VerifyRepayCalculation, 3, TestReInitialize); }
public void SeizeCollateralTest_pm() { TestRetrier.RunWithRetry(MainPageBb.VerifyCollateralCanBeSeized, 3, TestReInitialize); }