public void TestBypassReadNoRightsDoNotBypass() { 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(false, testObj.IsDirty); context.Assert.AreEqual(1, testObj.ReadId2ByPass()); context.Assert.AreEqual(0, testObj.ReadId2()); // 0 becuase we cannot read context.Assert.AreEqual(false, propertyChangedFired); context.Assert.Success(); Csla.ApplicationContext.User = new ClaimsPrincipal(); context.Complete(); }
public void TestBypassReadNoRightsDoNotBypass() { 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(false, testObj.IsDirty); context.Assert.AreEqual(1, testObj.ReadId2ByPass()); context.Assert.AreEqual(0, testObj.ReadId2()); // 0 becuase we cannot read context.Assert.AreEqual(false, propertyChangedFired); context.Assert.Success(); context.Complete(); }
public void TestBypassReadNoRightsDoNotBypass() { 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(false, testObj.IsDirty); context.Assert.AreEqual(1, testObj.ReadId2ByPass()); context.Assert.AreEqual(0, testObj.ReadId2()); // 0 becuase we cannot read context.Assert.AreEqual(false, propertyChangedFired); context.Assert.Success(); Csla.Test.Security.TestPrincipal.SimulateLogout(); context.Complete(); }