Ejemplo n.º 1
0
        public void ConstructWithNullGenerator(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 null generator"
            .x(() => generator.Should().BeNull());

            "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 generator"
            .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("generator"));
        }
Ejemplo n.º 2
0
        public void ConstructWithSuccess(IResourceGenerator generator, ILogger logger, Exception e)
        {
            "Given a null generator"
            .x(() => generator.Should().BeNull());

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

            "When constructing the generator"
            .x(() => e = Record.Exception(() => new YamlResourceGenerator(logger)));

            "Then the constructor should succeed"
            .x(() => e.Should().BeNull());
        }
Ejemplo n.º 3
0
        public void ConstructWithNullLogger(IResourceGenerator generator, ILogger logger, Exception e)
        {
            "Given a null generator"
            .x(() => generator.Should().BeNull());

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

            "When constructing the generator with null logger"
            .x(() => e = Record.Exception(() => new YamlResourceGenerator(logger)));

            "Then the constructor should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("logger"));
        }