示例#1
0
        public void TestInitializeTests()
        {
            var logger = new Mock <ILogger>();

            var container = new Mock <IObjectContainer>(MockBehavior.Strict);

            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IBrowser>(), null));
            container.Setup(c => c.RegisterInstanceAs <ISettingHelper>(It.IsAny <WrappedSettingHelper>(), null));
            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IPageMapper>(), null));
            container.Setup(c => c.RegisterInstanceAs <IScenarioContextHelper>(It.IsAny <ScenarioContextHelper>(), null));
            container.Setup(c => c.RegisterInstanceAs <ITokenManager>(It.IsAny <TokenManager>(), null));
            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IActionRepository>(), null));
            container.Setup(c => c.RegisterTypeAs <ActionPipelineService, IActionPipelineService>(null));
            container.Setup(c => c.RegisterTypeAs <ProxyLogger, ILogger>(null));
            container.Setup(c => c.Resolve <ILogger>()).Returns(logger.Object);

            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(ILocatorAction).IsAssignableFrom(t)), null)).Returns(new Mock <ILocatorAction>().Object);
            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(IPreAction).IsAssignableFrom(t)), null)).Returns(new Mock <IPreAction>().Object);
            container.Setup(c => c.Resolve(It.Is <Type>(t => typeof(IValidationComparer).IsAssignableFrom(t)), null)).Returns(new Mock <IValidationComparer>().Object);

            var driverSupport = new WebDriverSupport(container.Object);

            driverSupport.InitializeDriver();

            container.VerifyAll();
        }
        public void TestInitializeTests()
        {
            var logger    = new Mock <ILogger>();
            var container = new Mock <IObjectContainer>(MockBehavior.Strict);

            container.Setup(c => c.RegisterInstanceAs(It.IsAny <BrowserFactory>(), null, true));
            container.Setup(c => c.RegisterFactoryAs(It.IsAny <Func <IObjectContainer, IBrowser> >(), null));
            container.Setup(c => c.RegisterInstanceAs <ISettingHelper>(It.IsAny <WrappedSettingHelper>(), null, false));
            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IPageMapper>(), null, false));
            container.Setup(c => c.RegisterTypeAs <ScenarioContextHelper, IScenarioContextHelper>(null));
            container.Setup(c => c.RegisterTypeAs <TokenManager, ITokenManager>(null));
            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IActionRepository>(), null, false));
            container.Setup(c => c.RegisterInstanceAs(It.IsAny <IActionPipelineService>(), null, false));
            container.Setup(c => c.RegisterTypeAs <ProxyLogger, ILogger>(null));
            container.Setup(c => c.Resolve <ILogger>()).Returns(logger.Object);

            var driverSupport = new WebDriverSupport(container.Object);

            driverSupport.InitializeDriver();

            container.VerifyAll();
        }