Ejemplo n.º 1
0
        public void CreateApplicationWithSuccess(AP001ApplicationAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

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

            "And the model has a migration target "
            .x(() =>
            {
                model.MigrationTarget.MessageBus = new ApplicationModel.Target.MessageBus
                {
                    Name           = "namemessagebug",
                    Key            = "keymessageBus",
                    ResourceMapKey = "rsourceMapKeymessageBus",
                };
            });

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

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

            "And an analyzer"
            .x(() => analyzer = new AP001ApplicationAnalyzer(model, context, logger));

            "When analyzing"
            .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false));

            "Then there should be no exception"
            .x(() => e.Should().BeNull());

            "And 3 applications has been created"
            .x(() =>
            {
                model.Should().NotBeNull();
                model.MigrationTarget.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Applications.Should().HaveCount(3);
                model.MigrationTarget.MessageBus.Applications[0].Key.Should().Be("keymessageBus:TestApp1");
                model.MigrationTarget.MessageBus.Applications[0].ResourceMapKey.Should().Be("applicationTestApp1");
                model.MigrationTarget.MessageBus.Applications[1].Key.Should().Be("keymessageBus:TestApp2");
                model.MigrationTarget.MessageBus.Applications[1].ResourceMapKey.Should().Be("applicationTestApp2");
                model.MigrationTarget.MessageBus.Applications[2].Key.Should().Be("keymessageBus:TestApp3");
                model.MigrationTarget.MessageBus.Applications[2].ResourceMapKey.Should().Be("applicationTestApp3");
            });
        }
Ejemplo n.º 2
0
        public void ConstructWithNullContext(AP001ApplicationAnalyzer analyzer, ILogger logger, IApplicationModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

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

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

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

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

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

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

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

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

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());
        }