public void ThenIAmForbiddenToDeactivateBrand() { ScenarioContext.Current.Should().ContainKey("brandId"); var brandId = ScenarioContext.Current.Get <Guid>("brandId"); var ex = Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateBrand(new DeactivateBrandRequest() { BrandId = brandId })); Assert.That(ex.GetHttpCode(), Is.EqualTo((int)HttpStatusCode.Forbidden)); }
public void ThenBrandIsSuccessfullyDeactivated() { ScenarioContext.Current.Should().ContainKey("brandId"); var brandId = ScenarioContext.Current.Get <Guid>("brandId"); var data = new DeactivateBrandRequest { BrandId = brandId, Remarks = "Some remark" }; var result = AdminApiProxy.DeactivateBrand(data); result.Should().NotBeNull(); result.Success.Should().BeTrue(); }
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)); }