Changeset 11287
- Timestamp:
- 08/19/14 15:52:56 (10 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting.Views/3.4/VRPInstanceProviderView.cs
r11286 r11287 37 37 38 38 protected override void importButton_Click(object sender, EventArgs e) { 39 var provider = Content as IVRPInstanceProvider <T>;39 var provider = Content as IVRPInstanceProvider; 40 40 if (provider != null) { 41 41 using (var dialog = new VRPImportDialog(Content.Name)) { … … 43 43 var instance = provider.Import(dialog.VRPFileName, dialog.TourFileName); 44 44 try { 45 GenericConsumer.Load(instance );45 GenericConsumer.Load(instance as T); 46 46 instancesComboBox.SelectedIndex = -1; 47 47 } catch (Exception ex) { … … 54 54 55 55 protected override void exportButton_Click(object sender, EventArgs e) { 56 var provider = Content as IVRPInstanceProvider <T>;56 var provider = Content as IVRPInstanceProvider; 57 57 if (provider != null) { 58 58 if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/IVRPInstanceProvider.cs
r11286 r11287 21 21 22 22 namespace HeuristicLab.Problems.Instances.VehicleRouting { 23 public interface IVRPInstanceProvider <T> where T : IVRPData{23 public interface IVRPInstanceProvider { 24 24 bool CanImportData { get; } 25 TImport(string vrpFile, string tourFile);25 IVRPData Import(string vrpFile, string tourFile); 26 26 27 27 bool CanExportData { get; } 28 void Export( Tinstance, string path);28 void Export(IVRPData instance, string path); 29 29 } 30 30 } -
trunk/sources/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs
r11286 r11287 29 29 30 30 namespace HeuristicLab.Problems.Instances.VehicleRouting { 31 public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider <T>where T : IVRPData {31 public abstract class VRPInstanceProvider<T> : ProblemInstanceProvider<T>, IVRPInstanceProvider where T : IVRPData { 32 32 protected abstract string FileName { get; } 33 33 … … 107 107 protected abstract T LoadData(Stream stream); 108 108 109 public TImport(string vrpFile, string tourFile) {109 public IVRPData Import(string vrpFile, string tourFile) { 110 110 var data = ImportData(vrpFile); 111 111 if (!String.IsNullOrEmpty(tourFile)) { … … 115 115 } 116 116 117 public void Export( Tinstance, string path) {118 ExportData( instance, path);117 public void Export(IVRPData instance, string path) { 118 ExportData((T)instance, path); 119 119 } 120 120 -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.VehicleRouting-3.4/VRPInstancesTest.cs
r11171 r11287 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using System.Text; 25 using HeuristicLab.P luginInfrastructure;26 using HeuristicLab. Problems.Instances.VehicleRouting;26 using HeuristicLab.Problems.Instances; 27 using HeuristicLab.Tests; 27 28 using Microsoft.VisualStudio.TestTools.UnitTesting; 28 29 … … 30 31 [TestClass] 31 32 public class VRPInstancesTest { 33 [ClassInitialize] 34 public static void MyClassInitialize(TestContext testContext) { 35 PluginLoader.Assemblies.Any(); 36 } 37 32 38 [TestMethod] 33 39 [TestCategory("Problems.VehicleRouting")] 34 40 [TestProperty("Time", "long")] 35 41 public void TestVRPInstances() { 36 var providers = ApplicationManager.Manager.GetInstances<VRPInstanceProvider>();37 42 var vrp = new VehicleRoutingProblem(); 43 var providers = ProblemInstanceManager.GetProviders(vrp); 38 44 var failedInstances = new StringBuilder(); 39 45 … … 41 47 42 48 foreach (var provider in providers) { 43 var instances = provider.GetDataDescriptors();49 IEnumerable<IDataDescriptor> instances = ((dynamic)provider).GetDataDescriptors(); 44 50 Assert.IsTrue(instances.Any(), "No instances could be found."); 45 51 … … 47 53 try { 48 54 // throws InvalidOperationException if zero or more than one interpreter is found 49 vrp.Load(provider.LoadData(instance));55 ((dynamic)vrp).Load(((dynamic)provider).LoadData(instance)); 50 56 } catch (Exception exc) { 51 57 failedInstances.AppendLine(instance + ": " + exc.Message); -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r11091 r11287 330 330 <Private>False</Private> 331 331 </Reference> 332 <Reference Include="Microsoft.CSharp" /> 332 333 <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> 333 334 <Private>false</Private>
Note: See TracChangeset
for help on using the changeset viewer.