Example #1
0
        public void SaveOutputDashboardArmTemplate(OutputDashboardArmTemplate outputDashboardArmTemplate, TransformationDetails transformationDetails)
        {
            Directory.CreateDirectory(transformationDetails.OutputFilePath);

            File.WriteAllText($@"{transformationDetails.OutputFilePath}\dashboard.json", outputDashboardArmTemplate.TemplateJson);
            File.WriteAllText($@"{transformationDetails.OutputFilePath}\parameters.json", outputDashboardArmTemplate.ParametersJson);
        }
Example #2
0
        public void Setup()
        {
            this.reportedError                = null;
            this.userMessage                  = null;
            this.inputTemplate                = new InputDashboardArmTemplate("SomeJson");
            this.completeOutputTemplate       = new OutputDashboardArmTemplate("SomeOutputJson", "SomeParametersJson");
            this.partOfExistingTemplateOutput = new OutputDashboardArmTemplate("PartOutputJson", "SomeParametersJson");

            this.fileService           = A.Fake <ITransformationFileService>();
            this.transformationService = A.Fake <ITransformationService>();

            Messenger.Default.Register <Exception>(this, e => this.reportedError = e);
            Messenger.Default.Register <string>(this, e => this.userMessage      = e);
            this.mainViewModel = new MainViewModel(this.fileService, this.transformationService);
            this.mainViewModel.SourceFilePath   = @"C:\Input.json";
            this.mainViewModel.OutputFolderPath = OutputPath;

            A.CallTo(() => this.transformationService.Transform(this.inputTemplate, A <TransformationDetails> .That.Matches(x => x.DashboardIsCompleteTemplate.Equals(true)))).Returns(this.completeOutputTemplate);
            A.CallTo(() => this.transformationService.Transform(this.inputTemplate, A <TransformationDetails> .That.Matches(x => x.DashboardIsCompleteTemplate.Equals(false)))).Returns(this.partOfExistingTemplateOutput);
        }
 private void Transforming()
 {
     this.output = new TransformationService().Transform(this.inputDashboardArmTemplate, this.transformationDetails);
 }