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(); }
public void TestBypassReadWriteWithRightsTurnNotificationBackOn() { UnitTestContext context = GetContext(); Csla.Test.Security.TestPrincipal.SimulateLogin(); bool propertyChangedFired = false; BypassBusinessBase testObj = new BypassBusinessBase(); testObj.PropertyChanged += (o, e) => { propertyChangedFired = true; }; testObj.LoadIdByPass(1); context.Assert.AreEqual(1, testObj.ReadIdByPass()); context.Assert.AreEqual(false, propertyChangedFired); context.Assert.AreEqual(false, testObj.IsDirty); testObj.LoadIdByNestedPass(3); context.Assert.AreEqual(3, testObj.ReadIdByPass()); context.Assert.AreEqual(false, propertyChangedFired); context.Assert.AreEqual(false, testObj.IsDirty); testObj.LoadId(2); context.Assert.AreEqual(true, propertyChangedFired); context.Assert.AreEqual(2, testObj.ReadId()); context.Assert.AreEqual(true, testObj.IsDirty); context.Assert.Success(); Csla.Test.Security.TestPrincipal.SimulateLogout(); context.Complete(); }
public void TestBypassReadNoRightsDoNotBypassBackingField() { UnitTestContext context = GetContext(); Csla.Test.Security.TestPrincipal.SimulateLogin(); bool propertyChangedFired = false; BypassBusinessBase testObj = new BypassBusinessBase(); testObj.PropertyChanged += (o, e) => { propertyChangedFired = true; }; testObj.LoadId4ByPass(1); context.Assert.AreEqual(false, testObj.IsDirty); context.Assert.AreEqual(1, testObj.ReadId4ByPass()); context.Assert.AreEqual(0, testObj.ReadId4()); // 0 becuase we cannot read context.Assert.AreEqual(false, propertyChangedFired); context.Assert.Success(); Csla.Test.Security.TestPrincipal.SimulateLogout(); context.Complete(); }
public void TestBypassWriteNoRightsDoNotBypassBackingField() { UnitTestContext context = GetContext(); Csla.Test.Security.TestPrincipal.SimulateLogin(); BypassBusinessBase testObj = new BypassBusinessBase(); #if !SILVERLIGHT bool propertyChangedFired = false; testObj.PropertyChanged += (o, e) => { propertyChangedFired = true; }; testObj.LoadId4(1); context.Assert.AreEqual(true, testObj.IsDirty); context.Assert.AreEqual(1, testObj.ReadId4ByPass()); context.Assert.AreEqual(true, propertyChangedFired); #else context.Assert.Try(() => { testObj.LoadId2(1); }); #endif context.Assert.Success(); Csla.Test.Security.TestPrincipal.SimulateLogout(); context.Complete(); }