public void OneNameCriterion() { ITestMethod tm = new TestMethod(new TestFixture(typeof(SampleTestFixture)), typeof(SampleTestFixture).GetMethod("Foo")); var nameCriterion = new NameCriterion(typeof(SampleTestFixture).FullName + ".Foo"); var selection = new TestRun(nameCriterion); Assert.True(selection.Contains(tm)); }
public void CriterionIsRemovedForSecondTestRun() { var recipe = RecipeFactory.NewRecipe(string.Empty); recipe.AddAssembly(_testDll); var criterion = new NameCriterion("TestDll.ClassWithTests.ASucceedingTest"); var listener = new SimpleRecipeListener(recipe); recipe.RunTests(new TestRun(criterion)); recipe.Join(); Assert.Equals(1, listener.TestCount); listener = new SimpleRecipeListener(recipe); recipe.RunTests(new TestRun(new AllTestsCriterion())); recipe.Join(); Assert.Equals(3, listener.TestCount); }
public static Criterion CreateCriterionByName(string name) { Criterion result; if (!StatsCriterion.IsStatsIdentifier(name)) { switch (name) { case "PX": result = new AdminRightsCriterion(); return(result); case "Pa": result = new AlignementLevelCriterion(); return(result); case "Ps": result = new AlignmentCriterion(); return(result); case "PU": result = new BonesCriterion(); return(result); case "PG": result = new BreedCriterion(); return(result); case "PE": result = new EmoteCriterion(); return(result); case "Pb": result = new FriendListCriterion(); return(result); case "Pg": result = new GiftCriterion(); return(result); case "PO": result = new HasItemCriterion(); return(result); case "PJ": result = new JobCriterion(); return(result); case "PK": result = new KamaCriterion(); return(result); case "PL": result = new LevelCriterion(); return(result); case "MK": result = new MapCharactersCriterion(); return(result); case "PR": result = new MariedCriterion(); return(result); case "P¨Q": result = new MaxRankCriterion(); return(result); case "SG": result = new MonthCriterion(); return(result); case "PN": result = new NameCriterion(); return(result); case "Pe": result = new PreniumAccountCriterion(); return(result); case "PP": case "Pp": result = new PvpRankCriterion(); return(result); case "Qa": result = new QuestActiveCriterion(); return(result); case "Qf": result = new QuestDoneCriterion(); return(result); case "Qc": result = new QuestStartableCriterion(); return(result); case "Pq": result = new RankCriterion(); return(result); case "Pf": result = new RideCriterion(); return(result); case "SI": result = new ServerCriterion(); return(result); case "PS": result = new SexCriterion(); return(result); case "Pi": case "PI": result = new SkillCriterion(); return(result); case "PA": result = new SoulStoneCriterion(); return(result); case "Pr": result = new SpecializationCriterion(); return(result); case "Sc": result = new StaticCriterion(); return(result); case "PB": result = new SubAreaCriterion(); return(result); case "PZ": result = new SubscribeCriterion(); return(result); case "BI": result = new UnusableCriterion(); return(result); case "PW": result = new WeightCriterion(); return(result); case "Px": result = new GuildRightsCriterion(); return(result); case "Ox": result = new AllianceRightsCriterion(); return(result); case "Oc": result = new IgnoreCriterion(); return(result); } throw new System.Exception(string.Format("Criterion {0} doesn't not exist or not handled", name)); } result = new StatsCriterion(name); return(result); }
public static void Main(string[] args) { var book1 = new Book() { Author = "Джеффри Рихтер", Name = "CLR via C#", NumberOfPages = 896, PublishingOffice = "Питер", Year = 2017, Price = 67.50m, ISBN = "978-5-496-00433-6" }; var book2 = new Book() { Author = "Панос Луридас", Name = "Aлгоритмы для начинающих", NumberOfPages = 608, PublishingOffice = "Эксмо", Year = 2018, Price = 45.50m, ISBN = "978-5-04-089834-3" }; var appFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var storageFolder = Path.Combine(appFolder, "Storage"); Directory.CreateDirectory(storageFolder); var path = Path.Combine(storageFolder, "BookListStorage"); var storage = new BookStorage(path); var service = new BookListService(storage); service.AddBook(book1); service.AddBook(book2); foreach (var book in service.GetBooks()) { Console.WriteLine(book.ToString()); } Console.ReadKey(); Console.WriteLine(); service.RemoveBook(book2); var criterion = new NameCriterion("CLR via C#"); var book3 = service.FindBookByTag(criterion); Console.WriteLine(book3.ToString()); Console.ReadKey(); Console.WriteLine(); service.AddBook(book2); var books = service.SortBooksByTag(Comparer <Book> .Default); foreach (var book in books) { Console.WriteLine(book.ToString()); } Console.ReadKey(); File.Delete(path); }