public void ThenNewBrandIsSuccessfullyAdded() { var licensee = BrandTestHelper.CreateLicensee(); var data = new AddBrandRequest() { Code = TestDataGenerator.GetRandomString(), InternalAccounts = 1, EnablePlayerPrefix = true, PlayerPrefix = TestDataGenerator.GetRandomString(3), Licensee = licensee.Id, Name = TestDataGenerator.GetRandomString(), PlayerActivationMethod = PlayerActivationMethod.Automatic, TimeZoneId = TestDataGenerator.GetRandomTimeZone().Id, Type = BrandType.Integrated, Email = TestDataGenerator.GetRandomEmail(), SmsNumber = TestDataGenerator.GetRandomPhoneNumber(useDashes: false), WebsiteUrl = TestDataGenerator.GetRandomWebsiteUrl() }; var result = AdminApiProxy.AddBrand(data); result.Should().NotBeNull(); result.Success.Should().BeTrue(); result.Data.Should().NotBeNull(); }
public void ThenIAmUnauthorizedToExecuteBrandMethodsWithInvalidToken() { const HttpStatusCode statusCode = HttpStatusCode.Unauthorized; Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetUserBrands()).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandAddData()).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandEditData(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandViewData(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.AddBrand(new AddBrandRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.EditBrand(new EditBrandRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandCountries(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.ActivateBrand(new ActivateBrandRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.DeactivateBrand(new DeactivateBrandRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrands(false, new[] { new Guid() })).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandCountryAssignData(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.AssignBrandCountry(new AssignBrandCountryRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.AssignBrandCulture(new AssignBrandCultureRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.AssignBrandCurrency(new AssignBrandCurrencyRequest())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandCurrencies(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandCurrenciesWithNames(new Guid())).StatusCode, Is.EqualTo(statusCode)); Assert.That(Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBrandCurrencyAssignData(new Guid())).StatusCode, Is.EqualTo(statusCode)); }
public void ThenIAmForbiddenToExecutePermissionProtectedBrandMethodsWithInsufficientPermissions() { LogWithNewUser(Modules.VipLevelManager, Permissions.View); const int statusCode = (int)HttpStatusCode.Forbidden; Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandAddData()).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandEditData(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandViewData(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCountries(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCountryAssignData(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCultureAssignData(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCurrencies(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCurrenciesWithNames(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetBrandCurrencyAssignData(new Guid())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.AddBrand(new AddBrandRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.EditBrand(new EditBrandRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateBrand(new ActivateBrandRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateBrand(new DeactivateBrandRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.AssignBrandCountry(new AssignBrandCountryRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.AssignBrandCulture(new AssignBrandCultureRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.AssignBrandCurrency(new AssignBrandCurrencyRequest())).GetHttpCode(), Is.EqualTo(statusCode)); Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateContentTranslation(new AddContentTranslationModel())).GetHttpCode(), Is.EqualTo(statusCode)); }