Ejemplo n.º 1
0
        public void ConstructWithNullRepository(ResourceGeneratorAnalyzer analyzer, IConfigurationRepository repository, IResourceGenerator generator, IApplicationModel model, ILogger logger, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a null repository"
            .x(() => repository.Should().BeNull());

            "And a generator"
            .x(() => generator = _mockGenerator.Object);

            "And a model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing with a null repository"
            .x(() => e = Record.Exception(() => new ResourceGeneratorAnalyzer(repository, generator, model, context, logger)));

            "Then the constructor should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("repository"));
        }
Ejemplo n.º 2
0
        public void ConstructWithSuccess(ResourceGeneratorAnalyzer analyzer, IConfigurationRepository repository, IResourceGenerator generator, IApplicationModel model, ILogger logger, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a repository"
            .x(() => repository = _mockRepository.Object);

            "And a generator"
            .x(() => generator = _mockGenerator.Object);

            "And a model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing"
            .x(() => e = Record.Exception(() => new ResourceGeneratorAnalyzer(repository, generator, model, context, logger)));

            "Then the constructor should succeed"
            .x(() => e.Should().BeNull());
        }