Пример #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();
        }
Пример #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");
        }
Пример #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");
        }
Пример #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");
        }
Пример #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();
        }
Пример #6
0
 public void GetScopeContext_NotExist_ShouldOK()
 {
     ScopeContext.Resolve = () => new MockScopeService(true);
     ScopeContext.GetScopeContext("NotExist", false).ShouldNull();
 }