public void CreateFtpEndpointEmptyTransportData(SP001FtpSendPortAnalyzer 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 send port has no TransportTypeData" .x(() => { model.GetSourceModel <ParsedBizTalkApplicationGroup>().Applications[0].Application.Bindings.BindingInfo.SendPortCollection[0].PrimaryTransport.TransportTypeData = "<CustomProps><AdapterConfig vt=\"8\"><Config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"></Config></AdapterConfig></CustomProps>"; }); "And the model has a migration target " .x(() => { TestHelper.CopySourceToTarget(model, includeFtpSend: true); }); "And a context" .x(() => context = TestHelper.BuildContext()); "And a logger" .x(() => logger = _mockLogger.Object); "And an analyzer" .x(() => analyzer = new SP001FtpSendPortAnalyzer(model, context, logger)); "When analyzing" .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false)); "Then the constructor should NOT throw an exception" .x(() => e.Should().BeNull()); "And the message bus will have 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].Endpoints.Should().HaveCount(1); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Name.Should().Be("FTP Send Adapter"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Key.Should().Be("MessageBus:TestApp1:Test.SendPorts.SendPort1:AdapterEndpoint"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ResourceMapKey.Should().Be("ftpSendAdapterEndpointTestApp1FTPSendAdapter"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Properties.Should().HaveCount(9); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportLinks.Should().HaveCount(1); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportMessages.Should().HaveCount(1); }); }
public void FtpEndpointMissingWithError(SP001FtpSendPortAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e) { "Given an analyzer" .x(() => analyzer.Should().BeNull()); "And an empty model" .x(() => model = new AzureIntegrationServicesModel()); "And a populated model" .x(() => model = TestHelper.CreateDefaultModelForAnalyzing()); "And the model has a migration target" .x(() => { TestHelper.CopySourceToTarget(model, includeFtpSend: true); }); "And the target model is missing the endpoint" .x(() => { model.MigrationTarget.MessageBus.Applications[0].Endpoints.Clear(); }); "And a context" .x(() => context = TestHelper.BuildContext()); "And a logger" .x(() => logger = _mockLogger.Object); "And an analyzer" .x(() => analyzer = new SP001FtpSendPortAnalyzer(model, context, logger)); "When analyzing" .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false)); "Then the constructor should NOT throw an exception" .x(() => e.Should().BeNull()); "And an error should be raised" .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].Endpoints.Should().HaveCount(0); context.Errors.Should().HaveCount(1); }); }
public void CreateFtpEndpointSuccess(SP001FtpSendPortAnalyzer 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(() => { TestHelper.CopySourceToTarget(model, includeFtpSend: true); }); "And a context" .x(() => context = TestHelper.BuildContext()); "And a logger" .x(() => logger = _mockLogger.Object); "And an analyzer" .x(() => analyzer = new SP001FtpSendPortAnalyzer(model, context, logger)); "When analyzing" .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false)); "Then the constructor should NOT throw an exception" .x(() => e.Should().BeNull()); "And the message bus will have 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].Endpoints.Should().HaveCount(1); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Name.Should().Be("FTP Send Adapter"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Key.Should().Be("MessageBus:TestApp1:Test.SendPorts.SendPort1:AdapterEndpoint"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ResourceMapKey.Should().Be("ftpSendAdapterEndpointTestApp1FTPSendAdapter"); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Properties.Should().HaveCount(9); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportLinks.Should().HaveCount(1); model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportMessages.Should().HaveCount(12); }); }
public void ConstructWithNullContext(SP001FtpSendPortAnalyzer 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 SP001FtpSendPortAnalyzer(model, context, logger))); "Then the constructor should throw an exception" .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("context")); }
public void ConstructWithSuccess(SP001FtpSendPortAnalyzer 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 SP001FtpSendPortAnalyzer(model, context, logger))); "Then the constructor should NOT throw an exception" .x(() => e.Should().BeNull()); }