示例#1
0
        public void Site_Set_GetReturnsExpected()
        {
            var component = new SubComponent();

            Assert.Null(component.Site);

            var site = new MockSite();

            component.Site = site;
            Assert.Same(site, component.Site);
        }
示例#2
0
        public void DesignMode_GetWithSite_ReturnsExpected(bool result)
        {
            var site = new MockSite
            {
                DesignMode = result
            };
            var component = new SubComponent
            {
                Site = site
            };

            Assert.Equal(result, component.DesignMode);
        }
示例#3
0
        public void Container_GetWithSite_ReturnsExpected(Container result)
        {
            var site = new MockSite
            {
                Container = result
            };
            var component = new Component
            {
                Site = site
            };

            Assert.Same(result, component.Container);
        }
示例#4
0
        public void GetService_InvokeWithSite_ReturnsExpected(Type serviceType, Type result)
        {
            var site = new MockSite
            {
                ServiceType = result
            };
            var component = new SubComponent
            {
                Site = site
            };

            Assert.Same(result, component.GetService(serviceType));
        }
示例#5
0
        public void GetServiceType_CustomSite_ReturnsExpected()
        {
            var component = new SubComponent();

            Assert.Null(component.GetServiceInternal(typeof(int)));

            var site = new MockSite {
                ServiceType = typeof(bool)
            };

            component.Site = site;
            Assert.Equal(typeof(bool), component.GetServiceInternal(typeof(int)));
        }
示例#6
0
        public void DesignMode_Set_GetReturnsExpected()
        {
            var component = new SubComponent();

            Assert.False(component.GetDesignMode());

            var site = new MockSite {
                DesignMode = true
            };

            component.Site = site;
            Assert.True(component.GetDesignMode());
        }
示例#7
0
        public void Container_Set_GetReturnsExpected()
        {
            var component = new SubComponent();

            Assert.Null(component.Container);

            var site = new MockSite {
                Container = new Container()
            };

            component.Site = site;
            Assert.Same(site.Container, component.Container);
        }
示例#8
0
        public void Dispose_NonNullSiteContainer_RemovesComponentFromContainer()
        {
            var site = new MockSite
            {
                Container = new Container()
            };
            var component = new SubComponent
            {
                Site = site
            };

            component.Dispose();
            Assert.Null(component.Site);

            component.Dispose();
            Assert.Null(component.Site);
        }
示例#9
0
        public void Dispose_NullSiteContainer_Success()
        {
            var site = new MockSite
            {
                Container = null
            };
            var component = new SubComponent
            {
                Site = site
            };

            component.Dispose();
            Assert.Same(site, component.Site);

            component.Dispose();
            Assert.Same(site, component.Site);
        }