示例#1
0
        public void ThenIAmForbiddenToEditBrand()
        {
            ScenarioContext.Current.Should().ContainKey("brandId");
            var brandId = ScenarioContext.Current.Get <Guid>("brandId");

            var ex = Assert.Throws <HttpException>(() => AdminApiProxy.EditBrand(new EditBrandRequest()
            {
                Brand = brandId
            }));

            Assert.That(ex.GetHttpCode(), Is.EqualTo((int)HttpStatusCode.Forbidden));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
        public void ThenBrandDataIsSuccessfullyEdited()
        {
            ScenarioContext.Current.Should().ContainKey("brandId");
            var brandId = ScenarioContext.Current.Get <Guid>("brandId");

            ScenarioContext.Current.Should().ContainKey("licenseeId");
            var licenseeId = ScenarioContext.Current.Get <Guid>("licenseeId");

            var          newBrandName            = TestDataGenerator.GetRandomString(20);
            var          newBrandCode            = TestDataGenerator.GetRandomString(20);
            var          newTimeZoneId           = TestDataGenerator.GetRandomTimeZone().Id;
            var          newInternalAccountCount = TestDataGenerator.GetRandomNumber(10, 0);
            const string remarks = "Test updating brand";

            var data = new EditBrandRequest
            {
                Brand = brandId,
                Code  = newBrandCode,
                EnablePlayerPrefix = true,
                InternalAccounts   = newInternalAccountCount,
                Licensee           = licenseeId,
                Name         = newBrandName,
                PlayerPrefix = "AAA",
                TimeZoneId   = newTimeZoneId,
                Type         = BrandType.Deposit,
                Remarks      = remarks,
                Email        = TestDataGenerator.GetRandomEmail(),
                SmsNumber    = TestDataGenerator.GetRandomPhoneNumber(false),
                WebsiteUrl   = TestDataGenerator.GetRandomWebsiteUrl()
            };

            var result = AdminApiProxy.EditBrand(data);

            result.Should().NotBeNull();
            result.Success.Should().BeTrue();
        }