Beispiel #1
0
        public void NoDoubleInit()
        {
            UnitTestContext context = GetContext();

            ApplicationContext.GlobalContext.Clear();
            ApplicationContext.GlobalContext["Shared"] = 0;

            HasPerTypeRules2 root = new HasPerTypeRules2();

            root = new HasPerTypeRules2();

            int expected = (_initialized ? 0 : 1);
            int actual   = (int)ApplicationContext.GlobalContext["Shared"];

            context.Assert.AreEqual(expected, actual, "Rules should init just once");

            _initialized = true;
            context.Assert.Success();
            context.Complete();
        }
Beispiel #2
0
        public void NoDoubleInit()
        {
            IDataPortal <HasPerTypeRules2> dataPortal = _testDIContext.CreateDataPortal <HasPerTypeRules2>();

            UnitTestContext context = GetContext();

            TestResults.Reinitialise();
            TestResults.Add("Shared", "0");

            HasPerTypeRules2 root = dataPortal.Create();

            int expected = (_initialized ? 0 : 1);
            int actual   = int.Parse(TestResults.GetResult("Shared"));

            context.Assert.AreEqual(expected, actual, "Rules should init just once");

            _initialized = true;
            context.Assert.Success();
            context.Complete();
        }