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

            const int statusCode = (int)HttpStatusCode.Forbidden;

            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.ChangeBonusStatus(new ToggleBonusStatus())).GetHttpCode());
            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.CreateUpdateBonus(new CreateUpdateBonus())).GetHttpCode());
            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.GetBonusRelatedData()).GetHttpCode());
            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.DeleteBonusTemplate(new DeleteTemplate())).GetHttpCode());
            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.CreateUpdateBonusTemplate(new CreateUpdateTemplate())).GetHttpCode());
            Assert.AreEqual(statusCode, Assert.Throws <HttpException>(() => AdminApiProxy.GetBonusTemplateRelatedData()).GetHttpCode());
        }
Example #2
0
 public void ThenIAmUnauthorizedToExecuteBonusMethodsWithInvalidToken()
 {
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.ChangeBonusStatus(new ToggleBonusStatus())).StatusCode);
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.CreateUpdateBonus(new CreateUpdateBonus())).StatusCode);
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBonusRelatedData()).StatusCode);
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.DeleteBonusTemplate(new DeleteTemplate())).StatusCode);
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.CreateUpdateBonusTemplate(new CreateUpdateTemplate())).StatusCode);
     Assert.AreEqual(HttpStatusCode.Unauthorized, Assert.Throws <AdminApiProxyException>(() => AdminApiProxy.GetBonusTemplateRelatedData()).StatusCode);
 }