public void Should_cache_project_settings_when_enabled()
        {
            int settingsCounter = 0;

            var generatorServices = new GeneratorServicesMock(TestGeneratorFactoryStub.Object, true,
                                                              () => { settingsCounter++; return(new ProjectSettings()); });

            TestGeneratorFactoryStub.Setup(tgf => tgf.CreateGenerator(It.IsAny <ProjectSettings>())).Returns(TestGeneratorStub.Object);

            generatorServices.CreateTestGenerator();
            generatorServices.CreateTestGenerator();

            settingsCounter.Should().Be(1);
        }
        public void Should_requery_project_settings_when_invalidated()
        {
            int settingsCounter = 0;

            var generatorServices = new GeneratorServicesMock(TestGeneratorFactoryStub.Object, false,
                                                              () => { settingsCounter++; return(new ProjectSettings()); });

            TestGeneratorFactoryStub.Setup(tgf => tgf.CreateGenerator(It.IsAny <ProjectSettings>())).Returns(TestGeneratorStub.Object);

            generatorServices.CreateTestGenerator();
            generatorServices.InvalidateSettings();
            generatorServices.CreateTestGenerator();

            settingsCounter.Should().Be(2);
        }
        public void Should_create_test_generator()
        {
            var generatorServices = new GeneratorServicesMock(TestGeneratorFactoryStub.Object, false, null);

            TestGeneratorFactoryStub.Setup(tgf => tgf.CreateGenerator(It.IsAny <ProjectSettings>())).Returns(TestGeneratorStub.Object);

            var result = generatorServices.CreateTestGenerator();

            result.Should().NotBeNull();
            result.Should().Be(TestGeneratorStub.Object);
        }