Ejemplo n.º 1
0
        public RunnerIntegratedTests()
        {
            _suit.Reset();

            // RobotRunner has a dependency to ICommandExecutor which is set up to be an instance
            // of the real CommandExecutor with ILogger<CommandExecutor> dependency to be a loose mock
            _suit.SetDependencyToTestSuit <ICommandExecutor, CommandExecutor>();
            _suit.SetupDependencySuit <ICommandExecutor>(s =>
                                                         s.SetDependencyToLooseMock <ILogger <CommandExecutor> >());
        }
        public void DependencySetAsSuitInstance_CanConfigureIt()
        {
            //arrange
            _testSuit.SetDependencyToTestSuit <IDependency1>(TestSuit.Create <Dependency1>());

            //act
            _testSuit.SetupDependencySuit <IDependency1>(s => s.SetupMock <IDependency2>(d => d.Action2() == "42"));

            //assert
            // note: ParseNumberFromDependency() calls Dependency1.GetNumber() which in turn calls
            // IDependency2.Action2() which we mocked above
            _testSuit.Sut.ParseNumberFromDependency().Should().Be(42);
        }