public void ThenNewContentTranslationIsSuccessfullyCreated() { var contentName = TestDataGenerator.GetRandomString(); var contentSource = TestDataGenerator.GetRandomString(); ScenarioContext.Current.Should().ContainKey("cultureCode"); var cultureCode = ScenarioContext.Current.Get <string>("cultureCode"); var translation = new AddContentTranslationData() { ContentName = contentName, ContentSource = contentSource, Language = cultureCode, Translation = TestDataGenerator.GetRandomString() }; var data = new AddContentTranslationModel() { Languages = new List <string>(), Translations = new[] { translation }, ContentName = contentName, ContentSource = contentSource }; var result = AdminApiProxy.CreateContentTranslation(data); result.Should().NotBeNull(); result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK); }
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)); }