protected override void Arrange()
        {
            base.Arrange();
            applicationModel = Container.Resolve<ApplicationViewModel>();
            applicationModel.NewEnvironment();
            applicationModel.NewEnvironment();

            environment1 = applicationModel.Environments.First();
            environment2 = applicationModel.Environments.Skip(1).First();
            
        }
        protected override void Arrange()
        {
            base.Arrange();

            UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny<FileDialog>()))
              .Returns(new FileDialogResult { DialogResult = true, FileName = "unused.config" });

            UIServiceMock.Setup(x => x.ShowError(It.IsAny<string>())).Verifiable();

            appModel = Container.Resolve<ApplicationViewModel>();
            appModel.NewEnvironment();
            var validEnvironment = appModel.Environments.ElementAt(0);
            validEnvironment.EnvironmentDeltaFile = "mydeltafile.dconfig";
            Assert.IsFalse(validEnvironment.Properties
                                .SelectMany(p => p.ValidationResults)
                              .Where(e => e.IsError).Any());

            appModel.NewEnvironment();
            var invalidEnvironment = appModel.Environments.ElementAt(0);
            invalidEnvironment.EnvironmentDeltaFile = string.Empty;

            Assert.IsTrue(invalidEnvironment.Properties
                              .SelectMany(p => p.ValidationResults)
                              .Where(e => e.IsError).Any());
        }
        protected override void Arrange()
        {
            base.Arrange();

            UIServiceMock.Setup(
                x =>
                x.ShowMessageWpf(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<System.Windows.MessageBoxButton>()))
                .Returns(MessageBoxResult.No);

            var sectionViewModel = SourceModel.Sections.First();

            elementWeakReferences = sectionViewModel.DescendentElements().Union(new[] { sectionViewModel }).Select(e => new WeakReference(e)).ToArray();
            elementPropertyWeakReferences =
                sectionViewModel.DescendentElements().Union(new[] { sectionViewModel }).SelectMany(e => e.Properties).Select(
                    p => new WeakReference(p)).ToArray();

            appModel = Container.Resolve<ApplicationViewModel>();
            appModel.NewEnvironment();
        }
 protected override void Arrange()
 {
     base.Arrange();
     applicationModel = Container.Resolve<ApplicationViewModel>();
     applicationModel.NewEnvironment();
 }
        protected override void Arrange()
        {
            targetFile = "empty.dconfig";
            environmentConfigFile = "empty.config";

            ResourceHelper<ConfigFileLocator> helper = new ResourceHelper<ConfigFileLocator>();
            helper.DumpResourceFileToDisk(targetFile);
            helper.DumpResourceFileToDisk(environmentConfigFile);

            mainFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "any.config");
            base.Arrange();

            applicationModel = (ApplicationViewModel)Container.Resolve<IApplicationModel>();
            applicationModel.ConfigurationFilePath = mainFile;

            ConfigurationSourceModel sourceModel = Container.Resolve<ConfigurationSourceModel>();
            applicationModel.NewEnvironment();

            applicationModel.Environments.First().EnvironmentDeltaFile = targetFile;
            applicationModel.Environments.First().EnvironmentConfigurationFile = environmentConfigFile;

            UIServiceMock.Setup(x => x.ShowFileDialog(It.IsAny<SaveFileDialog>()))
                         .Callback(() => Assert.Fail());

            UIServiceMock.Setup(x => x.ShowMessageWpf(It.IsRegex("overwrite", RegexOptions.None), It.IsAny<string>(), System.Windows.MessageBoxButton.OKCancel))
                .Returns(MessageBoxResult.Yes)
                .Verifiable();
        }