public void Add_Puts_Features_In_Proper_Collections() { var validFeatureSet = FeatureSetLoader.LoadFeatureSetFromFeatureConfig(ParsedFeatureConfigSetupFixture.WellDefinedFeatureConfig); var compiledFeature = validFeatureSet.CompiledFeatures.First(); var configuredFeature = validFeatureSet.ConfiguredFeatures.First(); var testFeatureSet = new FeatureSet(); testFeatureSet.Add(compiledFeature); testFeatureSet.Add(configuredFeature); Assert.True(testFeatureSet.CompiledFeatures.First().Name == compiledFeature.Name); Assert.True(testFeatureSet.ConfiguredFeatures.First().Name == configuredFeature.Name); }
public void UnionWith_Puts_Features_In_Proper_Collections() { var validFeatureSet = FeatureSetLoader.LoadFeatureSetFromFeatureConfig(ParsedFeatureConfigSetupFixture.WellDefinedFeatureConfig); var compiledFeature = validFeatureSet.CompiledFeatures.First(); var configuredFeature = validFeatureSet.ConfiguredFeatures.First(); var featureSetToAdd = new FeatureSet(); featureSetToAdd.Add(compiledFeature); featureSetToAdd.Add(configuredFeature); var featureSet = new FeatureSet(); featureSet.UnionWith(featureSetToAdd); Assert.True(featureSet.CompiledFeatures.First().Name == compiledFeature.Name); Assert.True(featureSet.ConfiguredFeatures.First().Name == configuredFeature.Name); }
public void Add_Many_Features_Catches_Exceptions_If_Features_Have_Same_Name() { var validFeatureSet = FeatureSetLoader.LoadFeatureSetFromFeatureConfig(ParsedFeatureConfigSetupFixture.WellDefinedFeatureConfig); var compiledFeature = validFeatureSet.CompiledFeatures.First(); var configuredFeature = validFeatureSet.ConfiguredFeatures.First(); configuredFeature.Name = compiledFeature.Name; var compiledFeatures = new List <CompiledFeature> { compiledFeature }; Assert.DoesNotThrow(() => { var testFeatureSet = new FeatureSet(); testFeatureSet.Add(configuredFeature); testFeatureSet.Add(compiledFeatures); }); }
public void Add_Throws_Exception_When_Feature_Is_Not_Supported() { var unsupportedFeature = new UnsupportedFeature(); Assert.Throws <NotImplementedException>(() => { var testFeatureSet = new FeatureSet(); testFeatureSet.Add(unsupportedFeature); }); }
public void Add_Throws_Exception_If_CompiledFeature_And_ConfiguredFeature_Have_Same_Name() { var validFeatureSet = FeatureSetLoader.LoadFeatureSetFromFeatureConfig(ParsedFeatureConfigSetupFixture.WellDefinedFeatureConfig); var compiledFeature = validFeatureSet.CompiledFeatures.First(); var configuredFeature = validFeatureSet.ConfiguredFeatures.First(); configuredFeature.Name = compiledFeature.Name; Assert.Throws <ArgumentException>(() => { var testFeatureSet = new FeatureSet(); testFeatureSet.Add(compiledFeature); testFeatureSet.Add(configuredFeature); }); Assert.Throws <ArgumentException>(() => { var testFeatureSet = new FeatureSet(); testFeatureSet.Add(configuredFeature); testFeatureSet.Add(compiledFeature); }); }
/// <summary> /// Generate a Help object for this program /// </summary> /// <returns>Populated Help object</returns> private static FeatureSet RetrieveHelp() { // Create and add the header to the Help object string barrier = "-----------------------------------------"; List <string> helpHeader = new List <string>() { "RombaSharp - C# port of the Romba rom management tool", barrier, "Usage: RombaSharp [option] [filename|dirname] ...", string.Empty }; // Create the base help object with header FeatureSet help = new FeatureSet(helpHeader); // Add all of the features help.Add(new DisplayHelp()); help.Add(new DisplayHelpDetailed()); help.Add(new Archive()); help.Add(new Build()); help.Add(new Cancel()); help.Add(new DatStats()); help.Add(new DbStats()); help.Add(new Diffdat()); help.Add(new Dir2Dat()); help.Add(new EDiffdat()); help.Add(new Export()); help.Add(new Fixdat()); help.Add(new Import()); help.Add(new Lookup()); help.Add(new Memstats()); help.Add(new Merge()); help.Add(new Miss()); help.Add(new PurgeBackup()); help.Add(new PurgeDelete()); help.Add(new RefreshDats()); help.Add(new RescanDepots()); help.Add(new Progress()); help.Add(new Shutdown()); help.Add(new Features.Version()); return(help); }
/// <summary> /// Generate a Help object for this program /// </summary> /// <returns>Populated Help object</returns> private static FeatureSet RetrieveHelp() { // Create and add the header to the Help object string barrier = "-----------------------------------------"; List <string> helpHeader = new List <string>() { "SabreTools - Manipulate, convert, and use DAT files", barrier, "Usage: SabreTools [option] [flags] [filename|dirname] ...", string.Empty }; // Create the base help object with header FeatureSet help = new FeatureSet(helpHeader); // Add all of the features help.Add(new DisplayHelp()); help.Add(new DisplayHelpDetailed()); help.Add(new Batch()); help.Add(new DatFromDir()); help.Add(new Extract()); help.Add(new Restore()); help.Add(new Sort()); help.Add(new Split()); help.Add(new Stats()); help.Add(new Update()); help.Add(new Verify()); return(help); }