public void TestAllowInstanceAndShared() { ApplicationContext.GlobalContext.Clear(); Security.TestPrincipal.SimulateLogin(); ReadOnlyPerson person = ReadOnlyPerson.GetReadOnlyPerson(); Assert.AreEqual(true, Csla.ApplicationContext.User.IsInRole("Admin")); Assert.AreEqual("John", person.FirstName, "Should be able read first name"); Assert.AreEqual("Doe", person.LastName, "Should be able read first name"); Security.TestPrincipal.SimulateLogout(); ApplicationContext.GlobalContext.Clear(); Security.TestPrincipal.SimulateLogin(); ReadOnlyPerson clone = person.Clone(); Assert.AreEqual(true, Csla.ApplicationContext.User.IsInRole("Admin")); Assert.AreEqual("John", clone.FirstName, "Should be able read first name of clone"); Assert.AreEqual("Doe", clone.LastName, "Should be able read first name of clone"); }
public void TestAllowInstanceAndShared() { ApplicationContext.GlobalContext.Clear(); #pragma warning disable CS0436 // Type conflicts with imported type Security.TestPrincipal.SimulateLogin(); #pragma warning restore CS0436 // Type conflicts with imported type ReadOnlyPerson person = ReadOnlyPerson.GetReadOnlyPerson(); Assert.AreEqual(true, Csla.ApplicationContext.User.IsInRole("Admin")); Assert.AreEqual("John", person.FirstName, "Should be able read first name"); Assert.AreEqual("Doe", person.LastName, "Should be able read first name"); #pragma warning disable CS0436 // Type conflicts with imported type Security.TestPrincipal.SimulateLogout(); #pragma warning restore CS0436 // Type conflicts with imported type ApplicationContext.GlobalContext.Clear(); #pragma warning disable CS0436 // Type conflicts with imported type Security.TestPrincipal.SimulateLogin(); #pragma warning restore CS0436 // Type conflicts with imported type ReadOnlyPerson clone = person.Clone(); Assert.AreEqual(true, Csla.ApplicationContext.User.IsInRole("Admin")); Assert.AreEqual("John", clone.FirstName, "Should be able read first name of clone"); Assert.AreEqual("Doe", clone.LastName, "Should be able read first name of clone"); }