CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ClientContextTests.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ClientContextTests.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using System.Configuration;
9using System.Security.Principal;
10using UnitDriven;
11
12#if NUNIT
13using NUnit.Framework;
14using TestClass = NUnit.Framework.TestFixtureAttribute;
15using TestInitialize = NUnit.Framework.SetUpAttribute;
16using TestCleanup = NUnit.Framework.TearDownAttribute;
17using TestMethod = NUnit.Framework.TestAttribute;
18using TestSetup = NUnit.Framework.SetUpAttribute;
19#elif MSTEST
20using Microsoft.VisualStudio.TestTools.UnitTesting;
21#endif
22
24{
25#if TESTING
26 [System.Diagnostics.DebuggerStepThrough]
27#endif
28 [TestClass]
29 public partial class ClientContextTests : TestBase
30 {
31 #region Setup/Teardown
32
33 public static IPrincipal _currentPrincipal;
34 [TestInitialize]
35 public void Setup()
36 {
38 }
39
40 [TestCleanup]
41 public void Teardown()
42 {
45 }
46
47 #endregion
48
49 [TestMethod]
51 {
52 var context = GetContext();
53 context.Assert.IsNotNull(Csla.ApplicationContext.ClientContext);
54 context.Assert.Success();
55 context.Complete();
56 }
57
58 [TestMethod]
60 {
62 var context = GetContext();
63 context.Assert.IsTrue(Csla.ApplicationContext.ClientContext.Count == 0);
64 context.Assert.Success();
65 context.Complete();
66 }
67
68 [TestMethod]
70 {
71 var context = GetContext();
73 Csla.ApplicationContext.GlobalContext.Clear();
74
75 Csla.ApplicationContext.GlobalContext["TEST"] = "Test";
76
77 context.Assert.IsTrue(Csla.ApplicationContext.ClientContext.Count == 0);
78 context.Assert.IsTrue(Csla.ApplicationContext.GlobalContext.Count == 1);
79
80 context.Assert.Success();
81 context.Complete();
82 }
83 }
84
85}
Provides consistent context information between the client and server DataPortal objects.
void Clear()
Clears all context collections.
IPrincipal User
Get or set the current IPrincipal object representing the user's identity.
ContextDictionary ClientContext
Returns the application-specific context data provided by the client.