public void CreateSystemApplicationWithSuccess(AP002SystemApplicationAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e) { var messageBusKey = "messageBusKey"; "Given an analyzer" .x(() => analyzer.Should().BeNull()); "And a model" .x(() => model = new AzureIntegrationServicesModel()); "And the model has a message bus" .x(() => { model.MigrationTarget.MessageBus = new ApplicationModel.Target.MessageBus { Name = "Message Bus", Key = messageBusKey, ResourceMapKey = "messageBusResourceMapKey", }; }); "And a context" .x(() => context = TestHelper.BuildContext()); "And a logger" .x(() => logger = _mockLogger.Object); "And an analyzer" .x(() => analyzer = new AP002SystemApplicationAnalyzer(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 the system application will have been created" .x(() => { model.Should().NotBeNull(); model.MigrationTarget.Should().NotBeNull(); model.MigrationTarget.MessageBus.Should().NotBeNull(); model.MigrationTarget.MessageBus.Applications.Should().NotBeNullOrEmpty(); model.MigrationTarget.MessageBus.Applications.Should().HaveCount(1); var application = model.MigrationTarget.MessageBus.Applications[0]; application.Name.Should().Be("System Application"); application.Key.Should().Be($"{messageBusKey}:SystemApplication"); application.ResourceMapKey.Should().Be("systemApplication"); application.Description.Should().NotBeNullOrEmpty(); application.Rating.Should().Be(ApplicationModel.Report.ConversionRating.FullConversion); }); }
public void ConstructWithNullContext(AP002SystemApplicationAnalyzer 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 AP002SystemApplicationAnalyzer(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(AP002SystemApplicationAnalyzer 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 AP002SystemApplicationAnalyzer(model, context, logger))); "Then the constructor should NOT throw an exception" .x(() => e.Should().BeNull()); }