Example #1
0
        public void GetItemAs_Convert_ShouldOK()
        {
            ScopeContext.Resolve = () => new MockScopeService(true);
            var scopeContext = ScopeContext.GetScopeContext("001", false);

            scopeContext.GetItemAs("isFoo", false).ShouldTrue();
            scopeContext.GetItemAs("isFooX", false).ShouldFalse();
        }
Example #2
0
        public void GetItem_NotExistKey_ShouldOK()
        {
            ScopeContext.Resolve = () => new MockScopeService(true);
            var scopeContext = ScopeContext.GetScopeContext("001", false);

            scopeContext.GetItem("NotExist", null).ShouldNull();
            scopeContext.GetItem("NotExist", "A").ShouldEqual("A");
        }
Example #3
0
        public void GetItem_ExistKey_ShouldOK()
        {
            ScopeContext.Resolve = () => new MockScopeService(true);
            var scopeContext = ScopeContext.GetScopeContext("001", false);

            scopeContext.GetItem("foo").ShouldEqual("FOO");
            scopeContext.GetItem("FoO").ShouldEqual("FOO");
        }
Example #4
0
        public void SetItem_ExistKey_ShouldReplace()
        {
            ScopeContext.Resolve = () => new MockScopeService(true);
            var scopeContext = ScopeContext.GetScopeContext("001", false);

            scopeContext.SetItem("foo", "BAR");
            scopeContext.GetItem("foo", null).ShouldEqual("BAR");
        }
Example #5
0
        public void GetScopeContext_ReplaceResolve_ShouldOK()
        {
            ScopeContext.Resolve = () => new MockScopeService(true);
            ScopeContext.GetScopeContext("001", false).ShouldNotNull();

            //replace repos
            ScopeContext.Resolve = () => new MockScopeService(false);
            ScopeContext.GetScopeContext("001", false).ShouldNull();
        }
Example #6
0
 public void GetScopeContext_NotExist_ShouldOK()
 {
     ScopeContext.Resolve = () => new MockScopeService(true);
     ScopeContext.GetScopeContext("NotExist", false).ShouldNull();
 }