public void ThenIShouldSeeStatusCodeSuccessfulAndResponseSchemaValidated(int p0) { Assert.DoesNotThrow(async() => await MemberApiProxy.BonusRedemptionsAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetRedemption(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetQualifiedBonuses(new QualifiedBonusRequest() { Amount = 10 })); Assert.DoesNotThrow(async() => await MemberApiProxy.QualifiedFirstDepositBonuses(new QualifiedBonusRequest() { Amount = 10 })); Assert.DoesNotThrow(async() => await MemberApiProxy.GetFirstDepositBonuseByCode(new FirstDepositApplicationRequest())); Assert.DoesNotThrow(async() => await MemberApiProxy.ValidateFirstOnlineDeposit(new FirstDepositApplicationRequest() { BonusCode = TestDataGenerator.GetRandomString(4), DepositAmount = 50 })); Assert.DoesNotThrow(async() => await MemberApiProxy.GetCompleteBonuses()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetBonusesWithIncompleteWagering()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetVisibleDepositQualifiedBonuses(new QualifiedBonusRequest() { Amount = 10 })); }
public async Task ThenIShouldSeeStatusCodeCreatedAndResponseSchemaValidated(int p0) { //Act ScenarioContext.Current[ClaimedBonusRedemption] = await MemberApiProxy.ClaimRedemptionAsync(new ClaimRedemptionRequest()); //From this point on we check if the returned by the POST uri is not empty ScenarioContext.Current[ClaimedBonusRedemption].Should().NotBeNull(); var uriToClaimedRedemption = ((ClaimRedemptionResponse) (ScenarioContext.Current[ClaimedBonusRedemption])) .UriToClaimedRedemption; uriToClaimedRedemption.Should() .NotBeEmpty(); //From this point on we check if the returned by the POST uri is accurate and working using (var client = new HttpClient()) { AssignDefaultHeaderValues(client); CheckUpdatedEntityAvailability(client, uriToClaimedRedemption.Split('?')[0], uriToClaimedRedemption.Split('?')[1]); } }
public void ThenIShouldSeeStatusCodeIndicatingInternalServerError(int p0) { Assert.That( Assert.Throws <MemberApiProxyException>(async() => await MemberApiProxy.GetOnSiteMessagesAsync()) .StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); Assert.That( Assert.Throws <MemberApiProxyException>(async() => await MemberApiProxy.GetBalancesSetAsync()) .StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); Assert.That( Assert.Throws <MemberApiProxyException>( () => MemberApiProxy.GetAvailableLanguages(Guid.NewGuid())).StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); Assert.That( Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.RegistrationFormDataAsync(new RegistrationFormDataRequest() { BrandId = Guid.NewGuid() })).StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); Assert.That( Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ArePlayersIdDocumentsValid()).StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); ServiceLayerMockingHelper.VerifyLogginServiceWasCalledAfterInternalServerError(5); }
public void WhenITryToSendRequestToEndPointAndGetResponse() { var ipAddress = Get <string>(SecurityContextFields.IpAddress); var brandName = Get <string>(SecurityContextFields.BrandName); var request = new VerifyIpRequest { IpAddress = ipAddress, BrandName = brandName }; try { var result = MemberApiProxy.VerifyIp(request); result.Should().NotBeNull(); Set(SecurityContextFields.ErrorCode, HttpStatusCode.OK); Set(SecurityContextFields.Result, result); } catch (MemberApiValidationException e) { Set(SecurityContextFields.ErrorCode, e.StatusCode); var regoValidationError = e.ValidationErrors.FirstOrDefault(); if (regoValidationError != null) { Set(SecurityContextFields.ErrorMessage, regoValidationError.ErrorMessage); } } }
public void ThenAsAResponseIShouldSeeStatusCodeBadRequest(int p0) { Assert.Throws <MemberApiValidationException>(async() => await MemberApiProxy.ProfileAsync()); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetOnSiteMessageAsync(new OnSiteMessageRequest() { OnSiteMessageId = Guid.NewGuid() })); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetWalletsAsync(Guid.NewGuid())); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetPlayerData(TestDataGenerator.GetRandomString())); //Test anonymous requests SetInvalidToken(); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetSecurityQuestionAsync(Guid.NewGuid())); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetAcknowledgementDataAsync(Guid.NewGuid())); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetPlayerByResetPasswordToken(TestDataGenerator.GetRandomString())); }
public MemberApiController() { var appSettings = new AppSettings(); _brandId = appSettings.BrandId; var cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; string token = null; if (cookie != null && !String.IsNullOrWhiteSpace(cookie.Value)) { try { var formsTicket = FormsAuthentication.Decrypt(cookie.Value); if (formsTicket != null) { token = formsTicket.UserData; } } catch (CryptographicException) { } } _memberApiProxy = new MemberApiProxy(appSettings.MemberApiUrl.ToString(), token); }
public void WhenITryToSendRequestToBonusControllerAPI(string p0) { ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.BonusRedemptionsAsync()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetQualifiedBonuses(new QualifiedBonusRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.QualifiedFirstDepositBonuses(new QualifiedBonusRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetFirstDepositBonuseByCode(new FirstDepositApplicationRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ValidateFirstOnlineDeposit(new FirstDepositApplicationRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetCompleteBonuses()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetBonusesWithIncompleteWagering()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetVisibleDepositQualifiedBonuses(new QualifiedBonusRequest() { Amount = 10 })).Exception.ErrorMessage); }
public void ThenIShouldSeeStatusCodeForAllOfTheCalls(int p0) { Assert.Throws <MemberApiValidationException>(async() => await MemberApiProxy.GameListAsync(new GamesRequest { PlayerUsername = TestDataGenerator.GetRandomString() })); }
public async Task WhenIQueryTheOnlineDeposit() { var orderId = Get <string>(OnlineDepositOrderIdKey); var request = new CheckOnlineDepositStatusRequest { TransactionNumber = orderId }; var result = await MemberApiProxy.CheckOnlineDepositStatusAsync(request); Set(OnlineDepositQueryStatusResponseKey, result); }
public void ThenIShouldSeeStatusCodeSuccessfulForAllOfTheCalls(int p0) { Assert.DoesNotThrow(async() => await MemberApiProxy.GameListAsync(new GamesRequest { IsForMobile = true, LobbyUrl = TestDataGenerator.GetRandomString(), PlayerIpAddress = TestDataGenerator.GetRandomIpAddress(), PlayerUsername = TestDataGenerator.GetRandomString(), UserAgent = TestDataGenerator.GetRandomString() })); }
public async Task ThenOnlineDepositFormDataIsVisibleToMe() { var result = await MemberApiProxy.GetOnlineDepositFormDataAsync(BrandId); result.Should().NotBeNull(); result.PaymentGatewaySettings.Any().Should().BeTrue(); var settings = result.PaymentGatewaySettings.FirstOrDefault(); settings.PaymentGatewayName.Should().NotBeNullOrEmpty(); settings.Channel.Should().BeGreaterOrEqualTo(0); }
protected async Task LogInMemberApi(string username, string password) { var response = await MemberApiProxy.Login(new LoginRequest { BrandId = BrandId, Username = username, IPAddress = "::1", Password = password, RequestHeaders = new Dictionary <string, string>() }); Token = response.AccessToken; }
public async Task WhenISubmitOnlineDepositRequest() { var result = await MemberApiProxy.OnlineDepositAsync(new OnlineDepositRequest { Amount = 200, BrandId = BrandId, CultureCode = "en-US", NotifyUrl = "http://membersite/notifyurl", ReturnUrl = "http://memebersite/returnurl" }); Set(OnlineDepositResponseKey, result); }
public void ThenIShouldSeeStatusForNotAvailableService() { Assert.That( Assert.Throws <MemberApiProxyException>(async() => await MemberApiProxy.GetCompleteBonuses()) .StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); Assert.That( Assert.Throws <MemberApiProxyException>(async() => await MemberApiProxy.GetBonusesWithIncompleteWagering()) .StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError)); ServiceLayerMockingHelper.VerifyLogginServiceWasCalledAfterInternalServerError(2); }
public void ThenIShouldSeeStatusCodeBadRequest(int p0) { Assert.Throws <MemberApiValidationException>(async() => await MemberApiProxy.GetRedemption(Guid.NewGuid())); Assert.Throws <MemberApiValidationException>( async() => await MemberApiProxy.GetFirstDepositBonuseByCode(new FirstDepositApplicationRequest() { DepositAmount = 10, BonusCode = Guid.NewGuid().ToString(), PlayerId = Guid.NewGuid() })); Assert.Throws <MemberApiValidationException>(async() => await MemberApiProxy.GetVisibleDepositQualifiedBonuses(new QualifiedBonusRequest() { Amount = 100 })); }
public void ThenTheReceivedStatusCodeMustBeSuccessfulAndResponseSchemaValidated(int p0) { Assert.DoesNotThrow(async() => await MemberApiProxy.GetOfflineDepositFormDataAsync(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.PlayerLastDepositSummaryResponse()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetOnlinePaymentSetting(Guid.NewGuid(), String.Empty)); Assert.DoesNotThrow(async() => await MemberApiProxy.IsDepositorsFullNameValid(TestDataGenerator.GetRandomString())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetBankAccountsForOfflineDeposit()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetPendingDeposits()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetDeposits(1, null, null, null)); Assert.DoesNotThrow(async() => await MemberApiProxy.GetOfflineDeposit(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetWithdrawalFormDataAsync(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetBanks()); Assert.DoesNotThrow(async() => await MemberApiProxy.ValidatePlayerBankAccount(new PlayerBankAccountRequest())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetFundTransferFormDataAsync(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.ValidateOnlineDepositAmount(new ValidateOnlineDepositAmount())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetBankAccountForOfflineDeposit(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.CheckOnlineDepositStatusAsync(new CheckOnlineDepositStatusRequest())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetOnlineDepositFormDataAsync(Guid.NewGuid())); }
public void Before() { SecurityHelper = Container.Resolve <SecurityTestHelper>(); ValidationException = new RegoValidationException( new ValidationResult(new[] { new ValidationFailure("brandName", "InvalidBrandCode") })); ErrorMessagesFromUnauthorizedCalls = new List <string>(); _playerTestHelper = Container.Resolve <PlayerTestHelper>(); TestStartup.Container = Container; MemberApiUrl = GetAvailableUrl(PortRangeStart, PortRangeEnd); _webServer = WebApp.Start <TestStartup>(MemberApiUrl); MemberApiProxy = new MemberApiProxy(MemberApiUrl); }
public async Task WhenIPayOnPaymentGateway() { var orderId = Get <string>(OnlineDepositOrderIdKey); var fakeOrderId = DateTime.Now.ToString("yyyyMMddHHmmss"); var request = new OnlineDepositPayNotifyRequest { OrderIdOfMerchant = orderId, OrderIdOfGateway = "OID-Gateway" + fakeOrderId, OrderIdOfRouter = "OID-Router" + fakeOrderId, PayMethod = "XPAY", Language = "zh-CN" }; var sign = request.OrderIdOfMerchant + request.OrderIdOfRouter + request.OrderIdOfGateway + request.Language + OnlineDepositKey; request.Signature = EncryptHelper.GetMD5HashInHexadecimalFormat(sign); var result = await MemberApiProxy.OnlineDepositPayNotifyAsync(request); Set(OnlineDepositNotifyResponseKey, result); }
public void WhenITryToSendGETRequestToPlayerControllerEndPoint() { ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ProfileAsync()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.SecurityQuestionsAsync()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetOnSiteMessagesCountAsync()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetBalancesSetAsync()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetWalletsAsync(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetPlayerData(TestDataGenerator.GetRandomString())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ArePlayersIdDocumentsValid()).Exception.ErrorMessage); }
public void WhenITryToSendGETRequestWithoutHavingAValidTokenToPaymentControllerEndPoint() { ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetOfflineDepositFormDataAsync(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.PlayerLastDepositSummaryResponse()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetOnlinePaymentSetting(Guid.NewGuid(), String.Empty)).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.IsDepositorsFullNameValid(TestDataGenerator.GetRandomString())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetBankAccountsForOfflineDeposit()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetPendingDeposits()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetDeposits(1, null, null, null)).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetOfflineDeposit(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetWithdrawalFormDataAsync(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetBanks()).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ValidatePlayerBankAccount(new PlayerBankAccountRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetFundTransferFormDataAsync(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.ValidateOnlineDepositAmount(new ValidateOnlineDepositAmount())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetBankAccountForOfflineDeposit(Guid.NewGuid())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.CheckOnlineDepositStatusAsync(new CheckOnlineDepositStatusRequest())).Exception.ErrorMessage); ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GetOnlineDepositFormDataAsync(Guid.NewGuid())).Exception.ErrorMessage); //TODO: Add test cases for POST methods }
public void ThenIShouldSeeStatusCodeSuccessfulForEach(int p0, string p1) { Assert.DoesNotThrow(async() => await MemberApiProxy.ProfileAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.SecurityQuestionsAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetBalancesSetAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetAcknowledgementDataAsync(Guid.NewGuid())); Assert.DoesNotThrow( async() => await MemberApiProxy.GetOnSiteMessageAsync(new OnSiteMessageRequest() { OnSiteMessageId = Guid.NewGuid() })); Assert.DoesNotThrow(async() => await MemberApiProxy.GetOnSiteMessagesAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetOnSiteMessagesCountAsync()); Assert.DoesNotThrow(async() => await MemberApiProxy.GetWalletsAsync(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetPlayerData(TestDataGenerator.GetRandomString())); Assert.DoesNotThrow(async() => await MemberApiProxy.ArePlayersIdDocumentsValid()); //Test anonymous requests SetInvalidToken(); Assert.DoesNotThrow(async() => await MemberApiProxy.GetSecurityQuestionAsync(Guid.NewGuid())); Assert.DoesNotThrow( async() => await MemberApiProxy.RegistrationFormDataAsync(new RegistrationFormDataRequest() { BrandId = Guid.NewGuid() })); Assert.DoesNotThrow(() => MemberApiProxy.GetAvailableLanguages(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetAcknowledgementDataAsync(Guid.NewGuid())); Assert.DoesNotThrow(async() => await MemberApiProxy.GetPlayerByResetPasswordToken(Token)); }
public override void BeforeEach() { _webServer = WebApp.Start <TestStartup>("http://*:5555"); ServiceProxy = new MemberApiProxy("http://localhost:5555"); }
public void WhenITryToSendGETRequestToGameControllerEndPoint() { ErrorMessagesFromUnauthorizedCalls.Add(Assert.Throws <MemberApiProxyException>( async() => await MemberApiProxy.GameListAsync(new GamesRequest())).Exception.ErrorMessage); }
public void WhenITryToSendPOSTRequestToPlayerControllerEndPoint() { ServiceLayerMockingHelper.MockPlayerCommandsForHttpStatus201(Container); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromPasswordChanged] = await MemberApiProxy.ChangePasswordAsync(new ChangePasswordRequest() { OldPassword = LoggedInPlayerMetadata.Password, NewPassword = TestDataGenerator.GetRandomString(), Username = LoggedInPlayerMetadata.Username })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromPersonalInfoChanged] = await MemberApiProxy.ChangePersonalInfoAsync(new ChangePersonalInfoRequest() { PlayerId = PlayerId, FirstName = TestDataGenerator.GetRandomString(), LastName = TestDataGenerator.GetRandomString(), Email = TestDataGenerator.GetRandomEmail(), CurrencyCode = "CAD", DateOfBirth = DateTime.UtcNow.AddYears(-30).ToString("yyyy/MM/dd"), Gender = "Male", Title = "Mr", CountryCode = TestDataGenerator.GetRandomCountryCode(), MailingAddressCity = TestDataGenerator.GetRandomString(), MailingAddressLine1 = TestDataGenerator.GetRandomString(), MailingAddressPostalCode = TestDataGenerator.GetRandomNumber(1000).ToString(), PhoneNumber = TestDataGenerator.GetRandomPhoneNumber(), AccountAlertEmail = false, AccountAlertSms = true, MarketingAlertEmail = true, MarketingAlertPhone = false, MarketingAlertSms = false })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromContactInfoChanged] = await MemberApiProxy.ChangeContactInfoAsync(new ChangeContactInfoRequest() { PlayerId = PlayerId, MailingAddressCity = TestDataGenerator.GetRandomString(), PhoneNumber = TestDataGenerator.GetRandomPhoneNumber(false), CountryCode = LoggedInPlayerMetadata.Country, MailingAddressLine1 = TestDataGenerator.GetRandomString(), MailingAddressPostalCode = TestDataGenerator.GetRandomNumber(1000).ToString() })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromSelfExclusion] = await MemberApiProxy.SelfExclude(new SelfExclusionRequest() { Option = (int)PlayerEnums.SelfExclusion._1Year, PlayerId = PlayerId })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromTimeOut] = await MemberApiProxy.TimeOut(new TimeOutRequest() { PlayerId = PlayerId, Option = (int)PlayerEnums.TimeOut.Month })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromChangedSecurityQuestion] = await MemberApiProxy.ChangeSecurityQuestionAsync(new ChangeSecurityQuestionRequest() { Id = PlayerId.ToString(), SecurityAnswer = TestDataGenerator.GetRandomString(), SecurityQuestionId = LoggedInPlayerMetadata.SecurityQuestion })); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromMobilePhoneVerification] = await MemberApiProxy.VerificationCodeAsync(new VerificationCodeRequest())); Assert.DoesNotThrow(async() => ScenarioContext.Current[ResponseFromMobilePhoneVerified] = await MemberApiProxy.VerifyMobileAsync(new VerifyMobileRequest())); }
public ElmahErrorLogger(IDictionary config) { var appSettings = new AppSettings(); _serviceProxy = new MemberApiProxy(appSettings.MemberApiUrl.ToString(), Guid.NewGuid().ToString()); }
public override void BeforeEach() { base.BeforeEach(); FakeBrandRepository = Container.Resolve <FakeBrandRepository>(); FakePlayerRepository = Container.Resolve <FakePlayerRepository>(); FakePaymentRepository = Container.Resolve <FakePaymentRepository>(); FakeEventRepository = Container.Resolve <FakeEventRepository>(); FakeSecurityRepository = Container.Resolve <FakeSecurityRepository>(); FakeMessagingRepository = Container.Resolve <FakeMessagingRepository>(); for (int i = 0; i < TestDataGenerator.CountryCodes.Length; i++) { FakeBrandRepository.Countries.Add(new Country { Code = TestDataGenerator.CountryCodes[i] }); } for (int i = 0; i < TestDataGenerator.CurrencyCodes.Length; i++) { FakeBrandRepository.Currencies.Add(new Currency { Code = TestDataGenerator.CurrencyCodes[i] }); } for (int i = 0; i < TestDataGenerator.CultureCodes.Length; i++) { FakeBrandRepository.Cultures.Add(new Culture { Code = TestDataGenerator.CultureCodes[i] }); } var brandId = new Guid("00000000-0000-0000-0000-000000000138"); var brand = new Core.Brand.Interface.Data.Brand { Id = brandId, Name = "138", Status = BrandStatus.Active, TimezoneId = "Pacific Standard Time" }; for (int i = 0; i < TestDataGenerator.CurrencyCodes.Length; i++) { var currencyCode = TestDataGenerator.CurrencyCodes[i]; brand.BrandCurrencies.Add(new BrandCurrency { BrandId = brand.Id, Brand = brand, CurrencyCode = currencyCode, Currency = FakeBrandRepository.Currencies.Single(x => x.Code == currencyCode), DefaultPaymentLevelId = currencyCode == "CAD" ? new Guid("E1E600D4-0729-4D5C-B93E-085A94B55B33") : new Guid("1ED97A2B-EBA2-4B68-A70C-18A7070908F9") }); } for (int i = 0; i < TestDataGenerator.CountryCodes.Length; i++) { var countryCode = TestDataGenerator.CountryCodes[i]; brand.BrandCountries.Add(new BrandCountry { BrandId = brand.Id, Brand = brand, CountryCode = countryCode, Country = FakeBrandRepository.Countries.Single(x => x.Code == countryCode) }); } for (int i = 0; i < TestDataGenerator.CultureCodes.Length; i++) { var cultureCode = TestDataGenerator.CultureCodes[i]; brand.BrandCultures.Add(new BrandCulture { BrandId = brand.Id, Brand = brand, CultureCode = cultureCode, Culture = FakeBrandRepository.Cultures.Single(x => x.Code == cultureCode) }); } var walletTemplate = new WalletTemplate() { Brand = brand, Id = Guid.NewGuid(), IsMain = true, Name = "Main wallet", DateCreated = DateTimeOffset.UtcNow, CreatedBy = Guid.NewGuid() }; brand.WalletTemplates.Add(walletTemplate); brand.DefaultCulture = brand.BrandCultures.First().Culture.Code; brand.DefaultCurrency = brand.BrandCurrencies.First().Currency.Code; var vipLevel = new Core.Brand.Interface.Data.VipLevel { Name = "Standard", BrandId = brandId }; brand.DefaultVipLevelId = vipLevel.Id; brand.DefaultVipLevel = vipLevel; FakeBrandRepository.WalletTemplates.Add(walletTemplate); var playerVipLevel = new VipLevel { Id = Guid.NewGuid(), Name = "Standard", BrandId = brandId }; brand.DefaultVipLevelId = playerVipLevel.Id; FakeBrandRepository.Brands.Add(brand); var playerBrand = new Core.Common.Data.Player.Brand { Id = brand.Id, TimezoneId = brand.TimezoneId }; FakePlayerRepository.Brands.Add(playerBrand); FakePlayerRepository.VipLevels.Add(playerVipLevel); FakeMessagingRepository.VipLevels.Add(new Core.Messaging.Data.VipLevel { Id = playerVipLevel.Id, Name = playerVipLevel.Name }); FakeMessagingRepository.SaveChanges(); playerBrand.DefaultVipLevelId = playerVipLevel.Id; FakePlayerRepository.SaveChanges(); foreach (var questionid in TestDataGenerator.SecurityQuestions) { FakePlayerRepository.SecurityQuestions.Add(new SecurityQuestion { Id = new Guid(questionid), Question = TestDataGenerator.GetRandomString() }); } Container.Resolve <FakeGameRepository>().Brands.Add(new Core.Game.Interface.Data.Brand { Id = new Guid("00000000-0000-0000-0000-000000000138"), TimezoneId = TestDataGenerator.GetRandomTimeZone().Id }); var bankAccountType = new BankAccountType { Id = new Guid("00000000-0000-0000-0000-000000000100"), Name = "Main" }; FakePaymentRepository.Brands.Add(new Core.Payment.Data.Brand { Id = new Guid("00000000-0000-0000-0000-000000000138"), TimezoneId = "Pacific Standard Time" }); FakePaymentRepository.BankAccountTypes.Add(bankAccountType); var bank = new Bank { Id = Guid.NewGuid(), BankId = "SE45", BankName = "Bank of Canada", BrandId = brandId, CountryCode = "Canada", Created = DateTime.Now, CreatedBy = "initializer" }; FakePaymentRepository.Banks.Add(bank); var cadAccountId = new Guid("B6755CB9-8F9A-4EBA-87E0-1ED5493B7534"); FakePaymentRepository.BankAccounts.Add( new BankAccount { Id = cadAccountId, AccountId = "BoC1", AccountName = "John Doe", AccountNumber = "SE45 0583 9825 7466", AccountType = bankAccountType, Bank = bank, Branch = "Main", Province = "Vancouver", CurrencyCode = "CAD", Created = DateTime.Now, CreatedBy = "Initializer", Status = BankAccountStatus.Active, Updated = DateTime.Now, UpdatedBy = "Initializer" } ); bankAccountType = new BankAccountType { Id = new Guid("00000000-0000-0000-0000-000000000101"), Name = "VIP" }; FakePaymentRepository.BankAccountTypes.Add(bankAccountType); bank = new Bank { Id = Guid.NewGuid(), BankId = "70AC", BankName = "Hua Xia Bank", BrandId = brandId, CountryCode = "China", Created = DateTime.Now, CreatedBy = "initializer" }; FakePaymentRepository.Banks.Add(bank); var rmbAccountId = new Guid("13672261-70AC-46E3-9E62-9E2E3AB77663"); FakePaymentRepository.BankAccounts.Add( new BankAccount { Id = rmbAccountId, AccountId = "HXB1", AccountName = "Beijing", AccountNumber = "BA3912940494", //AccountType = "Main", AccountType = bankAccountType, Bank = bank, Branch = "Main", Province = "Beijing Municipality", CurrencyCode = "RMB", Created = DateTime.Now, CreatedBy = "Initializer", Status = BankAccountStatus.Active, Updated = DateTime.Now, UpdatedBy = "Initializer" } ); var paymentLevel = new PaymentLevel { Id = new Guid("E1E600D4-0729-4D5C-B93E-085A94B55B33"), BrandId = brandId, CurrencyCode = "CAD", Name = "CADLevel", Code = "CADLevel", EnableOfflineDeposit = true, DateCreated = DateTimeOffset.Now, CreatedBy = "Initializer" }; paymentLevel.BankAccounts.Add(FakePaymentRepository.BankAccounts.Single(a => a.Id == cadAccountId)); FakePaymentRepository.PaymentLevels.Add(paymentLevel); paymentLevel = new PaymentLevel { Id = new Guid("1ED97A2B-EBA2-4B68-A70C-18A7070908F9"), BrandId = brandId, CurrencyCode = "RMB", Name = "RMBLevel", Code = "RMBLevel", EnableOfflineDeposit = true, DateCreated = DateTimeOffset.Now, CreatedBy = "Initializer" }; paymentLevel.BankAccounts.Add(FakePaymentRepository.BankAccounts.Single(a => a.Id == rmbAccountId)); FakePaymentRepository.PaymentLevels.Add(paymentLevel); var licensee = new Licensee { Id = Guid.NewGuid(), AllowedBrandCount = 1, Status = LicenseeStatus.Active }; FakeBrandRepository.Licensees.Add(licensee); FakeBrandRepository.SaveChanges(); foreach (var culture in FakeBrandRepository.Cultures) { FakeMessagingRepository.Languages.Add(new Language { Code = culture.Code, Name = culture.Name }); } foreach (var thisBrand in FakeBrandRepository.Brands.Include(x => x.BrandCultures.Select(y => y.Culture))) { FakeMessagingRepository.Brands.Add(new Core.Messaging.Data.Brand { Id = thisBrand.Id, Name = thisBrand.Name, SmsNumber = TestDataGenerator.GetRandomPhoneNumber(), Email = TestDataGenerator.GetRandomEmail(), Languages = thisBrand.BrandCultures.Select(x => new Language { Code = x.Culture.Code, Name = x.Culture.Name }).ToList() }); } foreach (var thisPlayer in FakePlayerRepository.Players) { FakeMessagingRepository.Players.Add(new Core.Messaging.Data.Player { Id = thisPlayer.Id, Username = thisPlayer.Username, FirstName = thisPlayer.FirstName, LastName = thisPlayer.LastName, Email = thisPlayer.Email, Language = FakeMessagingRepository.Languages.Single(x => x.Code == thisPlayer.CultureCode), Brand = FakeMessagingRepository.Brands.Single(x => x.Id == thisPlayer.BrandId) }); } foreach (var thisBrand in FakeMessagingRepository.Brands.Include(x => x.Languages)) { foreach (var thisLanguage in thisBrand.Languages) { foreach (var messageType in (MessageType[])Enum.GetValues(typeof(MessageType))) { FakeMessagingRepository.MessageTemplates.Add(new MessageTemplate { BrandId = thisBrand.Id, LanguageCode = thisLanguage.Code, MessageType = messageType, MessageDeliveryMethod = MessageDeliveryMethod.Email, TemplateName = TestDataGenerator.GetRandomString(), MessageContent = string.Format("Fake email message Template. {0}.", Enum.GetName(typeof(MessageType), messageType)), Subject = TestDataGenerator.GetRandomString(), Status = Status.Active, CreatedBy = "System", Created = DateTimeOffset.UtcNow, ActivatedBy = "System", Activated = DateTimeOffset.UtcNow }); FakeMessagingRepository.MessageTemplates.Add(new MessageTemplate { BrandId = thisBrand.Id, LanguageCode = thisLanguage.Code, MessageType = messageType, MessageDeliveryMethod = MessageDeliveryMethod.Sms, TemplateName = TestDataGenerator.GetRandomString(), MessageContent = string.Format("Fake SMS message Template. {0}.", Enum.GetName(typeof(MessageType), messageType)), Status = Status.Active, CreatedBy = "System", Created = DateTimeOffset.UtcNow, ActivatedBy = "System", Activated = DateTimeOffset.UtcNow }); } } } FakeMessagingRepository.SaveChanges(); var securityHelper = Container.Resolve <SecurityTestHelper>(); securityHelper.PopulatePermissions(); var licenseeIds = new[] { licensee.Id }; var brandIds = new[] { brand.Id }; const string superAdminUsername = "******"; var adminId = RoleIds.SuperAdminId; var role = new Role { Id = adminId, Code = "SuperAdmin", Name = "SuperAdmin", CreatedDate = DateTime.UtcNow }; role.SetLicensees(licenseeIds); var user = new Core.Security.Data.Users.Admin { Id = adminId, Username = superAdminUsername, FirstName = superAdminUsername, LastName = superAdminUsername, IsActive = true, Description = superAdminUsername, Role = role }; user.SetLicensees(licenseeIds); foreach (var licenseeId in licenseeIds) { user.LicenseeFilterSelections.Add(new LicenseeFilterSelection { AdminId = user.Id, LicenseeId = licenseeId, Admin = user }); } user.SetAllowedBrands(brandIds); foreach (var item in brandIds) { user.BrandFilterSelections.Add(new BrandFilterSelection { AdminId = user.Id, BrandId = item, Admin = user }); } FakeSecurityRepository.Admins.AddOrUpdate(user); var authCommands = Container.Resolve <IAuthCommands>(); authCommands.CreateRole(new CreateRole { RoleId = adminId, Permissions = Container.Resolve <IAuthQueries>().GetPermissions().Select(p => p.Id).ToList() }); authCommands.CreateActor(new CreateActor { ActorId = adminId, Username = superAdminUsername, Password = superAdminUsername }); authCommands.AssignRoleToActor(new AssignRole { ActorId = adminId, RoleId = adminId }); FakeSecurityRepository.SaveChanges(); securityHelper.SignInAdmin(user); var testServerUri = ConfigurationManager.AppSettings["TestServerUri"]; TestStartup.Container = Container; _webServer = WebApp.Start <TestStartup>(testServerUri); PlayerWebservice = new MemberApiProxy(testServerUri); }
protected void SetInvalidToken() { Token = TestDataGenerator.GetRandomString(300); MemberApiProxy = new MemberApiProxy(MemberApiUrl, Token); }