public void IAuthorizeDataPortal_Implementation_DoesNotAllow_Creation()
        {
            var context = GetContext();

            //setup for the test
            SetAppSettingValueCmd
            .ExecuteCommand(
                "CslaAuthorizationProvider",
                "Csla.Testing.Business.DataPortal.DontAuthorizeDataPortalStub, Csla.Testing.Business",
                (o, e) =>
            {
                //actual test
                var dp              = new DataPortal <TestBO>();
                dp.CreateCompleted += ((sender, e1) =>
                {
                    context.Assert.IsNotNull(e1.Error);
                    //TODO: perhaps check to assure that exception type is Csla.Security.SecurityException
                    //context.Assert.IsTrue(((Csla.DataPortalException)(e1.Error)).ErrorInfo.InnerError.ExceptionTypeName=="Csla.Security.SecurityException");
                    context.Assert.Success();
                });
                dp.BeginCreate();
            });

            context.Complete();
        }
Exemplo n.º 2
0
 public void Teardown()
 {
     //Setting CslaAuthorizationnProvider to "" will force NullAuthorizer - we can not set it here as it is protected class
     SetAppSettingValueCmd.ExecuteCommand(
         "CslaAuthorizationProvider", "",
         (o, e) =>
         { });
 }
Exemplo n.º 3
0
        public async Task IAuthorizeDataPortal_Implementation_Allows_Delete()
        {
            var cmd = new SetAppSettingValueCmd(
                "CslaAuthorizationProvider",
                "Csla.Testing.Business.DataPortal.AuthorizeDataPortalStub, Csla.Testing.Business");
            await Csla.DataPortal.ExecuteAsync(cmd);

            //Setting CslaAuthorizationnProvider to "" will force NullAuthorizer - we can not set it here as it is protected class
            var command = new SetAppSettingValueCmd("CslaAuthorizationProvider", "");
            await Csla.DataPortal.ExecuteAsync(command);
        }
Exemplo n.º 4
0
        public async Task IAuthorizeDataPortal_Implementation_Allows_Fetch()
        {
            //setup for the test
            var command = new SetAppSettingValueCmd(
                "CslaAuthorizationProvider",
                "Csla.Testing.Business.DataPortal.AuthorizeDataPortalStub, Csla.Testing.Business");
            await Csla.DataPortal.ExecuteAsync(command);

            //actual test
            var dp = new DataPortal <TestBO>();
            await dp.FetchAsync();

            //Setting CslaAuthorizationnProvider to "" will force NullAuthorizer - we can not set it here as it is protected class
            command = new SetAppSettingValueCmd("CslaAuthorizationProvider", "");
            await Csla.DataPortal.ExecuteAsync(command);
        }
Exemplo n.º 5
0
        public void IAuthorizeDataPortal_Implementation_Allows_Fetch()
        {
            var context = GetContext();

            //setup for the test
            SetAppSettingValueCmd
            .ExecuteCommand(
                "CslaAuthorizationProvider",
                "Csla.Testing.Business.DataPortal.AuthorizeDataPortalStub, Csla.Testing.Business",
                (o, e) =>
            {
                //actual test
                var dp             = new DataPortal <TestBO>();
                dp.FetchCompleted += ((sender, e1) =>
                {
                    context.Assert.IsNull(e1.Error);
                    context.Assert.Success();
                });
                dp.BeginFetch(1);
            });

            context.Complete();
        }