Пример #1
0
        public void Initialize_NoCustomRootStateLoaded_ThrowInvalidOperationException()
        {
            // arrange
            ILogManager lm = this.mocks.NewMock<ILogManager>();
            Stub.On( lm ).Method( "Trace" ).WithAnyArguments();
            IPluginManager pm = this.mocks.NewMock<IPluginManager>();
            Stub.On( pm ).Method( "GetPluginsForType" ).WithAnyArguments().Will( Return.Value( new List<Attribute>() { null } ) );
            INGinCore c = this.mocks.NewMock<INGinCore>();
            ISceneManager scm = this.mocks.NewMock<ISceneManager>();
            Stub.On( scm ).Method( "CreateAndAddScene" ).Will( Return.Value( null ) );
            Stub.On( c ).Method( "GetService" ).With( typeof( SmTestState ) ).Will( Return.Value( new SmTestState( scm, lm ) ) );
            Stub.On( c ).EventAdd( "RunStarted" );
            Stub.On( c ).EventRemove( "RunStarted" );
            Stub.On( c ).EventAdd( "RunStopped" );
            Stub.On( c ).EventRemove( "RunStopped" );
            StateManager sm = new StateManager( lm, pm, c );
            IMachine m = this.mocks.NewMock<IMachine>();
            Stub.On( m ).Method( "Initialize" ).WithAnyArguments();

            // act
            sm.Initialize( pm, m, c );

            // assert
        }
Пример #2
0
        public void StateManager_LogManagerNull_ThrowArgumentNullException()
        {
            // arrange
            StateManager sm;
            ILogManager lm = null;
            IPluginManager pm = this.mocks.NewMock<IPluginManager>();
            INGinCore c = this.mocks.NewMock<INGinCore>();
            Stub.On( c ).EventAdd( "RunStarted" );
            Stub.On( c ).EventRemove( "RunStarted" );
            Stub.On( c ).EventAdd( "RunStopped" );
            Stub.On( c ).EventRemove( "RunStopped" );

            // act
            sm = new StateManager( lm, pm, c );

            // assert
        }
Пример #3
0
        public void StateManager_ValidLogManager_CreateInstance()
        {
            // arrange
            StateManager sm;
            ILogManager lm = this.mocks.NewMock<ILogManager>();
            Stub.On(lm).Method("Trace").WithAnyArguments();
            IPluginManager pm = this.mocks.NewMock<IPluginManager>();
            INGinCore c = this.mocks.NewMock<INGinCore>();
            Stub.On( c ).EventAdd( "RunStarted" );
            Stub.On( c ).EventRemove( "RunStarted" );
            Stub.On( c ).EventAdd( "RunStopped" );
            Stub.On( c ).EventRemove( "RunStopped" );

            // act
            sm = new StateManager( lm, pm, c );

            // assert
            Assert.IsNotNull( sm );
            Assert.IsInstanceOf<StateManager>( sm );
        }