public void ParseSuccessfulOneSendPort(PipelineDataParser parser, ILogger logger, List <SendPort> sendPorts, MigrationContext context, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e) { "Given a model with one send port" .x(() => { model = new AzureIntegrationServicesModel(); sendPorts = new List <SendPort> { new SendPort() }; group = CreateGroup(sendPorts.ToArray()); model.MigrationSource.MigrationSourceModel = group; }); "And a logger" .x(() => logger = _mockLogger.Object); "And a context" .x(() => context = new MigrationContext()); "And a parser" .x(() => parser = new SendPortPipelineDataParser(model, context, logger)); "When parsing" .x(() => e = Record.Exception(() => parser.Parse())); "Then the code should not throw an exception" .x(() => e.Should().BeNull()); }
public void ParseOneSendPortAndValidReceiveData(PipelineDataParser parser, ILogger logger, List <SendPort> sendPorts, MigrationContext context, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e) { "Given a model with one send port and valid receive data XML" .x(() => { model = new AzureIntegrationServicesModel(); sendPorts = new List <SendPort> { new SendPort() }; sendPorts[0].ReceivePipelineData = ValidData; group = CreateGroup(sendPorts.ToArray()); model.MigrationSource.MigrationSourceModel = group; }); "And a logger" .x(() => logger = _mockLogger.Object); "And a context" .x(() => context = new MigrationContext()); "And a parser" .x(() => parser = new SendPortPipelineDataParser(model, context, logger)); "When parsing" .x(() => e = Record.Exception(() => parser.Parse())); "Then the code should not throw an exception" .x(() => e.Should().BeNull()); "And there should be no errors" .x(() => { context.Errors.Should().HaveCount(0); }); "And there should be valid receive configuration" .x(() => { sendPorts[0].ReceivePipelineCustomConfiguration.Should().NotBeNull(); sendPorts[0].ReceivePipelineCustomConfiguration.Stages.Should().HaveCount(1); var rootStage = sendPorts[0].ReceivePipelineCustomConfiguration.Stages.FirstOrDefault(); rootStage.Components.Should().NotBeNull(); rootStage.Components[0].Should().NotBeNull(); rootStage.Components[0].Name.Should().NotBeNullOrWhiteSpace(); rootStage.Components[0].Properties.Should().HaveCount(1); var property = rootStage.Components[0].Properties.SingleOrDefault(); property.Should().NotBeNull(); property.Name.Should().NotBeNullOrWhiteSpace(); property.Value.Should().NotBeNullOrWhiteSpace(); property.ValueType.Should().NotBeNullOrWhiteSpace(); }); "And there should be no send configuration" .x(() => { sendPorts[0].SendPipelineCustomConfiguration.Should().BeNull(); }); }
public void ParseSuccessfulNoReceivePorts(PipelineDataParser parser, ILogger logger, MigrationContext context, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e) { "Given a model with no receive ports" .x(() => { model = new AzureIntegrationServicesModel(); group = CreateGroup(Array.Empty <ReceivePort>()); model.MigrationSource.MigrationSourceModel = group; }); "And a logger" .x(() => logger = _mockLogger.Object); "And a context" .x(() => context = new MigrationContext()); "And a parser" .x(() => parser = new ReceivePortPipelineDataParser(model, context, logger)); "When parsing" .x(() => e = Record.Exception(() => parser.Parse())); "Then the code should not throw an exception" .x(() => e.Should().BeNull()); "And the receive pipeline is still empty" .x(() => group.Applications[0].Application.Bindings.BindingInfo.ReceivePortCollection.Should().BeNullOrEmpty()); }
public void ParseFailureMissingBindings(PipelineDataParser parser, ILogger logger, List <ReceivePort> receivePorts, MigrationContext context, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e) { "Given a model with one receive port" .x(() => { model = new AzureIntegrationServicesModel(); receivePorts = new List <ReceivePort> { new ReceivePort() { Name = "Test Port" } }; group = CreateGroup(receivePorts.ToArray()); model.MigrationSource.MigrationSourceModel = group; group.Applications[0].Application.Bindings = null; // Set this to be null to force the skip in processing }); "And a logger" .x(() => logger = _mockLogger.Object); "And a context" .x(() => context = new MigrationContext()); "And a parser" .x(() => parser = new ReceivePortPipelineDataParser(model, context, logger)); "When parsing" .x(() => e = Record.Exception(() => parser.Parse())); "And the model should be parsed with a warning." .x(() => { // There should be no exception logged - this is a handled scenario. context.Errors.Count.Should().Be(0); // The application definition cannot be read and so the name should be default var group = (ParsedBizTalkApplicationGroup)model.MigrationSource.MigrationSourceModel; group.Applications[0].Application.Name.Should().Be("(Unknown)"); // An error should be logged var invocation = _mockLogger.Invocations.Where(i => i.Arguments[0].ToString() == "Warning").FirstOrDefault(); invocation.Should().NotBeNull(); invocation.Arguments[2].ToString().Should().Contain("Unable to find the binding info resource"); }); }
public void ParseOneReceivePortAndInvalidSendData(PipelineDataParser parser, ILogger logger, List <ReceivePort> receivePorts, MigrationContext context, AzureIntegrationServicesModel model, ParsedBizTalkApplicationGroup group, Exception e) { "Given a model with one receive port invalid send data XML" .x(() => { model = new AzureIntegrationServicesModel(); receivePorts = new List <ReceivePort> { new ReceivePort() { Name = "Test Port" } }; receivePorts[0].SendPipelineData = "Invalid XML"; group = CreateGroup(receivePorts.ToArray()); model.MigrationSource.MigrationSourceModel = group; }); "And a logger" .x(() => logger = _mockLogger.Object); "And a context" .x(() => context = new MigrationContext()); "And a parser" .x(() => parser = new ReceivePortPipelineDataParser(model, context, logger)); "When parsing" .x(() => e = Record.Exception(() => parser.Parse())); "Then the code should not throw an exception" .x(() => e.Should().BeNull()); "And there should be one error" .x(() => { context.Errors.Should().HaveCount(1); context.Errors[0].Message.Should().Contain("Send"); }); }