public void Should_not_cache_project_settings_when_not_enabled()
        {
            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.CreateTestGenerator();

            settingsCounter.ShouldEqual(2);
        }
        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.ShouldEqual(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.ShouldEqual(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.ShouldNotBeNull();
            result.ShouldEqual(TestGeneratorStub.Object);
        }
        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.ShouldNotBeNull();
            result.ShouldEqual(TestGeneratorStub.Object);
        }