/// <summary>
        /// Creates a mock <see cref="IReactEnvironment"/> and registers it with the IoC container
        /// This is only required because <see cref="HtmlHelperExtensions"/> can not be
        /// injected :(
        /// </summary>
        private ReactEnvironmentTest.Mocks ConfigureMockReactEnvironment()
        {
            var mocks = new ReactEnvironmentTest.Mocks();

            var environment = mocks.CreateReactEnvironment();

            AssemblyRegistration.Container.Register <IReactEnvironment>(environment);
            return(mocks);
        }
예제 #2
0
        /// <summary>
        /// Creates a mock <see cref="IReactEnvironment"/> and registers it with the IoC container
        /// This is only required because <see cref="HtmlHelperExtensions"/> can not be
        /// injected :(
        /// </summary>
        private ReactEnvironmentTest.Mocks ConfigureMockReactEnvironment()
        {
            var mocks = new ReactEnvironmentTest.Mocks();

            mocks.Engine.Setup(x => x.Evaluate <bool>("typeof ComponentName !== 'undefined'")).Returns(true);

            var environment = mocks.CreateReactEnvironment();

            AssemblyRegistration.Container.Register <IReactEnvironment>(environment);
            return(mocks);
        }