Example #1
0
        public void ThenICanNotExecuteProtectedAdminMethodsWithInsufficientPermissions()
        {
            LogWithNewUser(Modules.VipLevelManager, Permissions.View);

            const int statusCode = (int)HttpStatusCode.Forbidden;

            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCountry(new EditCountryData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteCountry(new DeleteCountryData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateCulture(new ActivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateCulture(new DeactivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCulture(new EditCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateCurrency(new ActivateCurrencyData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateCulture(new DeactivateCultureData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.SaveCurrency(new EditCurrencyData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateUserInAdminManager(new AddAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateUserInAdminManager(new EditAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ResetPasswordInAdminManager(new AddAdminData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.ActivateUserInAdminManager(new ActivateUserData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeactivateUserInAdminManager(new DeactivateUserData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetLicenseeDataInAdminManager(new GetLicenseeData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateRoleInRoleManager(new AddRoleData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateRoleInRoleManager(new EditRoleData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.GetLicenseeDataInRoleManager(new List <Guid>())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateSettingInIdentificationDocumentSettings(new IdentificationDocumentSettingsData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateSettingInIdentificationDocumentSettings(new IdentificationDocumentSettingsData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateIpRegulationInAdminIpRegulations(new EditAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateIpRegulationInAdminIpRegulations(new EditAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteIpRegulationInAdminIpRegulations(new DeleteAdminIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.CreateIpRegulationInBrandIpRegulations(new AddBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.UpdateIpRegulationInBrandIpRegulations(new RegoV2.Core.Common.Data.Admin.EditBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
            Assert.That(Assert.Throws <HttpException>(() => AdminApiProxy.DeleteIpRegulationInBrandIpRegulations(new DeleteBrandIpRegulationData())).GetHttpCode(), Is.EqualTo(statusCode));
        }
Example #2
0
        public void ThenUserIsSuccessfullyDeactivated()
        {
            ScenarioContext.Current.Should().ContainKey("userId");
            var userId = ScenarioContext.Current.Get <Guid>("userId");

            var data = new DeactivateUserData()
            {
                Id = userId
            };

            var result = AdminApiProxy.DeactivateUserInAdminManager(data);

            result.Should().NotBeNull();
            result.StatusCode.ShouldBeEquivalentTo(HttpStatusCode.OK);
        }