コード例 #1
0
        public void TestBypassReadWriteNoRightsTurnNotificationBackOn()
        {
            UnitTestContext context = GetContext();

            Csla.Test.Security.TestPrincipal.SimulateLogin();
            bool propertyChangedFired = false;

            BypassBusinessBase testObj = new BypassBusinessBase();

            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2ByPass(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(false, propertyChangedFired);
            context.Assert.AreEqual(false, testObj.IsDirty);
#if !SILVERLIGHT
            testObj.LoadId2(2);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass()); // still one becuase set failed
            context.Assert.AreEqual(true, testObj.IsDirty);
#else
            context.Assert.Try(() =>
            {
                testObj.LoadId2(2);
            });
#endif

            context.Assert.Success();
            Csla.Test.Security.TestPrincipal.SimulateLogout();
            context.Complete();
        }
コード例 #2
0
        public void TestBypassWriteNoRightsDoNotBypass()
        {
            UnitTestContext context = GetContext();

            Csla.Test.Security.TestPrincipal.SimulateLogin();
            BypassBusinessBase testObj = new BypassBusinessBase();

#if !SILVERLIGHT
            bool propertyChangedFired = false;
            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(true, propertyChangedFired);
            context.Assert.AreEqual(true, testObj.IsDirty);
#else
            context.Assert.Try(() =>
            {
                testObj.LoadId2(1);
            });
#endif
            context.Assert.Success();
            Csla.Test.Security.TestPrincipal.SimulateLogout();
            context.Complete();
        }
コード例 #3
0
        public void TestBypassReadWriteNoRightsTurnNotificationBackOn()
        {
            UnitTestContext context = GetContext();

#pragma warning disable CS0436 // Type conflicts with imported type
            Csla.Test.Security.TestPrincipal.SimulateLogin();
#pragma warning restore CS0436 // Type conflicts with imported type
            bool propertyChangedFired = false;

            BypassBusinessBase testObj = new BypassBusinessBase();
            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2ByPass(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(false, propertyChangedFired);
            context.Assert.AreEqual(false, testObj.IsDirty);
            testObj.LoadId2(2);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass()); // still one becuase set failed
            context.Assert.AreEqual(true, testObj.IsDirty);
            context.Assert.Success();
#pragma warning disable CS0436 // Type conflicts with imported type
            Csla.Test.Security.TestPrincipal.SimulateLogout();
#pragma warning restore CS0436 // Type conflicts with imported type
            context.Complete();
        }
コード例 #4
0
        public void TestBypassWriteNoRightsDoNotBypass()
        {
            TestDIContext testDIContext = TestDIContextFactory.CreateContext(GetPrincipal("Admin"));
            IDataPortal <BypassBusinessBase> dataPortal = testDIContext.CreateDataPortal <BypassBusinessBase>();

            UnitTestContext    context = GetContext();
            BypassBusinessBase testObj = dataPortal.Fetch();
            bool propertyChangedFired  = false;

            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(true, propertyChangedFired);
            context.Assert.AreEqual(true, testObj.IsDirty);
            context.Assert.Success();
            context.Complete();
        }
コード例 #5
0
        public void TestBypassWriteNoRightsDoNotBypass()
        {
            UnitTestContext context = GetContext();

            Csla.ApplicationContext.User = GetPrincipal("Admin");
            BypassBusinessBase testObj = new BypassBusinessBase();
            bool propertyChangedFired  = false;

            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(true, propertyChangedFired);
            context.Assert.AreEqual(true, testObj.IsDirty);
            context.Assert.Success();
            Csla.ApplicationContext.User = new ClaimsPrincipal();
            context.Complete();
        }
コード例 #6
0
        public void TestBypassReadWriteNoRightsTurnNotificationBackOn()
        {
            TestDIContext testDIContext = TestDIContextFactory.CreateContext(GetPrincipal("Admin"));
            IDataPortal <BypassBusinessBase> dataPortal = testDIContext.CreateDataPortal <BypassBusinessBase>();

            UnitTestContext context = GetContext();
            bool            propertyChangedFired = false;

            BypassBusinessBase testObj = dataPortal.Fetch();

            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2ByPass(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(false, propertyChangedFired);
            context.Assert.AreEqual(false, testObj.IsDirty);
            testObj.LoadId2(2);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass()); // still one becuase set failed
            context.Assert.AreEqual(true, testObj.IsDirty);
            context.Assert.Success();
            context.Complete();
        }
コード例 #7
0
        public void TestBypassReadWriteNoRightsTurnNotificationBackOn()
        {
            UnitTestContext context = GetContext();

            Csla.ApplicationContext.User = GetPrincipal("Admin");
            bool propertyChangedFired = false;

            BypassBusinessBase testObj = new BypassBusinessBase();

            testObj.PropertyChanged += (o, e) =>
            {
                propertyChangedFired = true;
            };
            testObj.LoadId2ByPass(1);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass());
            context.Assert.AreEqual(false, propertyChangedFired);
            context.Assert.AreEqual(false, testObj.IsDirty);
            testObj.LoadId2(2);
            context.Assert.AreEqual(1, testObj.ReadId2ByPass()); // still one becuase set failed
            context.Assert.AreEqual(true, testObj.IsDirty);
            context.Assert.Success();
            Csla.ApplicationContext.User = new ClaimsPrincipal();
            context.Complete();
        }