public void AddProductConfigurationRows()
 {
     var model = new ConfigurationModel();
     var flavorNameA = "TestFlavor";
     var flavorNameB = "TestFlavor2";
     var productA = "ProductA";
     var productB = "ProductB";
     model.Flavors = new List<ConfigurationModel.FlavorOptions>
     {
         new ConfigurationModel.FlavorOptions
         {
             FlavorName = flavorNameA, IncludedProductTitles = new List<string> { productA }
         },
         new ConfigurationModel.FlavorOptions
         {
             FlavorName = flavorNameB, IncludedProductTitles = new List<string> { productB }
         }
     };
     var product = new ConfigurationModel.Product {Title = productB};
     model.Products = new List<ConfigurationModel.Product>
     {
         new ConfigurationModel.Product {Title = productA},
         product
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasProduct(testView, model.Products[0]);
     TestThatViewHasProduct(testView, model.Products[1]);
     TestThatProductIsSelectedForTheseFlavors(testView, model.Products[0], new List<string> { flavorNameA });
     TestThatProductIsSelectedForTheseFlavors(testView, model.Products[1], new List<string> { flavorNameB });
 }
 public ConfigurationWizard(ConfigurationController controller)
 {
     _controller = controller;
     InitializeComponent();
     AddFlavorNameHeaders();
     controller.PopulateWithModelSettings(this);
 }
 public void AddTaskSelections()
 {
     var model = new ConfigurationModel();
     model.Tasks = new ConfigurationModel.TasksToExecuteSettings
     {
         GatherFiles = true,
         BuildSelfExtractingDownloadPackage = true,
         Compile = true,
         OutputFolder = "C:/temp",
         RememberSettings = true,
         SelfExtractingStyle = "SfxFw",
         WriteInstallerXml = true,
         WriteDownloadsXml = true
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     // Assert defaults to ensure a valid test
     Assert.False(testView.GatherFiles || testView.Compile || testView.BuildSelfExtractingDownloadPackage ||
                  testView.RememberSettings || testView.WriteInstallerXml || testView.WriteDownloadsXml, "Expected all booleans to default to false, test invalid");
     controller.PopulateWithModelSettings(testView);
     Assert.True(testView.GatherFiles && testView.Compile && testView.BuildSelfExtractingDownloadPackage &&
                      testView.RememberSettings && testView.WriteInstallerXml && testView.WriteDownloadsXml, "Expected all booleans to be set to true");
     Assert.That(testView.OutputFolder, Is.EqualTo(model.Tasks.OutputFolder));
     Assert.That(testView.SelfExtractingStyle, Is.EqualTo(model.Tasks.SelfExtractingStyle));
 }
Пример #4
0
 static void Main()
 {
     var controller = new ConfigurationController(null);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new ConfigurationWizard(controller));
 }
 public ConfigurationWizard(ConfigurationController controller)
 {
     _controller = controller;
     InitializeComponent();
     AddFlavorNameHeaders();
     controller.PopulateWithModelSettings(this);
 }
Пример #6
0
        static void Main()
        {
            var controller = new ConfigurationController(null);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ConfigurationWizard(controller));
        }
 public void AddFlavorWorks()
 {
     var model = new ConfigurationModel();
     var flavorName = "TestFlavor";
     model.Flavors = new List<ConfigurationModel.FlavorOptions> { new ConfigurationModel.FlavorOptions { FlavorName = flavorName}};
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
 }
 public void DeleteFlavorWorks()
 {
     var deleteFlavor = new ConfigurationModel.FlavorOptions { FlavorName = "DeletedFlavor", DownloadURL = "localhost" };
     var model = new ConfigurationModel();
     var flavorName = "TestFlavor";
     model.Flavors = new List<ConfigurationModel.FlavorOptions>
     {
         new ConfigurationModel.FlavorOptions { FlavorName = flavorName },
         deleteFlavor
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
     TestThatViewHasFlavor(testView, model.Flavors[1]);
     // SUT
     controller.DeleteLastFlavor(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
     TestThatViewDoesNotHaveFlavor(testView, deleteFlavor);
 }
 public void TestBadBitmapPathLogged()
 {
     var model = new ConfigurationModel { FileLocation = Path.GetTempFileName()};
     var testPath = "C:\\Test.bmp";
     model.General = new ConfigurationModel.GeneralOptions { ListBackground = new ConfigurationModel.ListBackgroundOptions { ImagePath = testPath}};
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     testView.Compile = true;
     try
     {
         controller.ExecuteTasks(testView);
         // The warning message complains about legacy projects when the bitmap has any path separaters
         TestMessageLogged(testView, "legacy data");
         // The warning message should contain the image path
         TestMessageLogged(testView, testPath);
     }
     finally
     {
         try
         {
             File.Delete(model.FileLocation);
         }
         catch (Exception)
         {
             // We tried to delete it, but this test shouldn't fail if we couldn't
         }
     }
 }