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.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GlobalCOntextTests.server.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="GlobalCOntextTests.server.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 Csla.Security;
11using UnitDriven;
12
13#if NUNIT
14using TestMethod = NUnit.Framework.TestAttribute;
15
16#elif MSTEST
17using Microsoft.VisualStudio.TestTools.UnitTesting;
18#endif
19
21{
22#if TESTING
23 [System.Diagnostics.DebuggerStepThrough]
24#endif
25 //[TestClass]
26 public partial class GlobalContextTests : TestBase
27 {
28 [TestMethod]
29 [TestCategory("SkipWhenLiveUnitTesting")]
31 {
32 var context = GetContext();
33
34 Csla.ApplicationContext.User = new System.Security.Claims.ClaimsPrincipal();
35
36 Csla.ApplicationContext.DataPortalProxy = "Csla.Testing.Business.TestProxies.AppDomainProxy, Csla.Testing.Business";
37
38 var verifier = new GlobalContextBOVerifier(true);
39
40 //This is what we are transferring
42
43 verifier.Name = "justin";
44 var result = Csla.DataPortal.Update<GlobalContextBOVerifier>(verifier);
45
46
47 context.Assert.IsNotNull(result);
48 context.Assert.AreEqual(ContextMessageValues.INITIAL_VALUE, result.ReceivedContextValue);
49 context.Assert.Success();
50
51 context.Complete();
52 }
53
54 [TestMethod]
55 [TestCategory("SkipWhenLiveUnitTesting")]
57 {
58 var context = GetContext();
59 Csla.ApplicationContext.User = new System.Security.Claims.ClaimsPrincipal();
60
61 Csla.ApplicationContext.DataPortalProxy = "Csla.Testing.Business.TestProxies.AppDomainProxy, Csla.Testing.Business";
62
63 var verifier = new GlobalContextBOVerifier(false);
64
65 //This is what we are transferring
67
68 var result = Csla.DataPortal.Update<GlobalContextBOVerifier>(verifier);
69
70 context.Assert.AreEqual(ContextMessageValues.MODIFIED_VALUE, Csla.ApplicationContext.GlobalContext["MSG"]);
71
72 context.Assert.Success();
73 context.Complete();
74
75 }
76
77 }
78}
Provides consistent context information between the client and server DataPortal objects.
IPrincipal User
Get or set the current IPrincipal object representing the user's identity.
Client side data portal used for making asynchronous data portal calls in .NET.
Definition: DataPortalT.cs:24
T Update(T obj)
Called by a factory method in a business class or by the UI to update an object.
Definition: DataPortalT.cs:467
UnitTestContext GetContext()
Definition: TestBase.cs:12