Esempio n. 1
0
        public void GetSectionData_ValidSection_DataValid()
        {
            // arrange
            Type expectedType = typeof( PluginsConfigXml );
            ISectionXml testSection = this.CreateSectionMock( "plugins", this.xmlPluginsConfig, expectedType.FullName );
            IModuleXml moduleMock = this.CreateModuleMock( "testModule", "NGin.Core.Test.NGinModuleConfigTest.TestModule", testSection );
            NGinModuleConfig config = new NGinModuleConfig( moduleMock );
            string sectionName = "plugins";
            ISectionXml expectedSection = config.GetSectionCloned( sectionName );
            object data = null;

            // act
            data = config.GetSectionData( sectionName );

            // assert
            Assert.IsNotNull( data );
            Assert.IsInstanceOf( expectedType, data );
            Assert.AreEqual( expectedSection.Data, data );
            Assert.AreEqual( expectedSection.DataType, data.GetType() );
        }
Esempio n. 2
0
        public void GetSectionData_UnknownSection_RaiseArgumentException()
        {
            // arrange
            IModuleXml moduleMock = this.CreateModuleMock( "testModule", "NGin.Core.Test.NGinModuleConfigTest.TestModule" );
            NGinModuleConfig config = new NGinModuleConfig( moduleMock );
            string sectionName = Guid.NewGuid().ToString();
            object data = null;

            // act
            data = config.GetSectionData( sectionName );

            // assert
        }