/// <summary>
        /// Builds the list of files that will be created for the report and allocates data to them.
        /// </summary>
        private void BuildFileStructure()
        {
            _files.Summary = new ReportFile <ReportSummary>(HtmlResources.FileListSummary, null, Model.Report.Summary, string.Empty)
            {
                Filename = Path.GetFileName(Context.ReportFilePath)
            };

            foreach (var container in Model.MigrationSource.ResourceContainers)
            {
                var application = container.FindResourcesByType(ModelConstants.ResourceApplication).FirstOrDefault();

                // Defensive check.
                if (application == null)
                {
                    Logger.LogWarning(WarningMessages.NoValidResourcesFound, container.Name);
                    continue;
                }
                _files.SourceApplications.Add(new ReportFile <ResourceContainer>(application.Name, application.Description, container, HtmlResources.FileListPrefixSource));
            }

            _files.TargetMessageBus = new ReportFile <MessageBus>(HtmlResources.FileListMessageBus, HtmlResources.FileListMessageBusDescription, Model.MigrationTarget.MessageBus, "MessageBus");

            var targetApplications = TargetScenarioModeller.DecodeTargetModel(Model.MigrationTarget);

            foreach (var application in targetApplications)
            {
                _files.TargetApplications.Add(new ReportFile <TargetApplication>(application.Application.Name, application.Application.Description, application, HtmlResources.FileListPrefixTarget));
            }
        }
Esempio n. 2
0
        public void DecodeScenariosHappyPath(AzureIntegrationServicesModel model, IList <TargetApplication> result)
        {
            "Given a model"
            .x(() =>
            {
                model = TestHelper.BuildModel();
            });

            "When comparing x and y"
            .x(() => result = TargetScenarioModeller.DecodeTargetModel(model.MigrationTarget));

            "Expect the correct number of applications"
            .x(() => {
                var results = result.ToList();
                results.Count.Should().Be(2);
            });
        }