private static void AssertResponseListOfTransactions(Response <List <Delegate> > response) { Assert.AreEqual(51, response.Meta.Count); Assert.AreEqual(1, response.Meta.PageCount); Assert.AreEqual(51, response.Meta.TotalCount); Assert.AreEqual(null, response.Meta.Next); Assert.AreEqual(null, response.Meta.Previous); Assert.AreEqual("/api/v2/delegates?page=1&limit=100", response.Meta.Self); Assert.AreEqual("/api/v2/delegates?page=1&limit=100", response.Meta.First); Assert.AreEqual("/api/v2/delegates?page=1&limit=100", response.Meta.Last); CollectionAssert.AllItemsAreInstancesOfType(response.Data, typeof(Delegate)); CollectionAssert.AllItemsAreNotNull(response.Data); CollectionAssert.AllItemsAreUnique(response.Data); Assert.AreEqual(51, response.Data.Count()); }
public void ShouldValidateWhenOnlyErrors() { //Reads multiple validations , all supposed to fail and returns a list of exactly the same number of errors. _segment = new StringValidator.Segment(new StringValidator(""), "1500", "integger"); var result = _segment.ExpectThat(Is.DateTime("ddMMyyyy"), Is.Matching(@"\dr"), Is.OneOf("a", "b", "c")).Read(); Assert.IsTrue(result.HasErrors); Assert.AreEqual(3, result.SegmentErrors.Count); CollectionAssert.AllItemsAreUnique(result.SegmentErrors); for (var i = 0; i < 3; i++) { var segmentError = result.SegmentErrors[i]; Assert.AreEqual("integger", segmentError.SegmentName); } }
public void TestUpdateAndRollbackRange() { Repository r = null; using (var ctx = new ProLawEntities()) { r = new Repository(ctx, EntityFramework_Repository.ConnectionFactory.ConnectionMethod.CurrentContextConnection, null, false); r.QueueContextChange(new Matters { Matters1 = "RepoTestUpdateAndRollbackRange", MatterID = "RepoTestUpdateAndRollbackRange", AddingDateTime = DateTime.Now, AddingProfessionals = "RepoTest" }); Assert.IsTrue(r.CommitContextChanges()); var toUpdate = ctx.Matters.Where(m => m.Matters1 == "RepoTestUpdateAndRollbackRange").FirstOrDefault(); Assert.IsNotNull(toUpdate); toUpdate.MatterID = null; toUpdate.AddingDateTime = null; toUpdate.AddingProfessionals = null; r.QueueContextChange(toUpdate); foreach (var item in r.ChangeLogQueue.Where(q => q.CommittedAt == null)) { Console.WriteLine(item.Entry_ID + ") " + item.TableUpdated + "." + item.ColumnUpdated + ": " + item.NewValue); } var idList = r.ChangeLogQueue.Where(q => q.PrimaryKey == toUpdate.Matters1.ToString() && (q.ColumnUpdated == "MatterID" || q.ColumnUpdated == "AddingProfessionals")).Select(q => q.Entry_ID); Assert.AreNotEqual(0, idList.Count()); CollectionAssert.AllItemsAreUnique(idList.ToList()); var begChangeID = idList.OrderBy(id => id).FirstOrDefault(); var endChangeID = idList.OrderByDescending(id => id).FirstOrDefault(); Assert.IsTrue(begChangeID < endChangeID); Assert.IsTrue(r.CommitContextChanges()); Assert.IsTrue(r.RollBackChangesByRange(begChangeID, endChangeID)); Assert.IsNull(ctx.Matters.Where(m => m.MatterID == null).FirstOrDefault()); } }
public void WhenAddingItemsWhileShuffled_OrderIsSameAsBeforeButWithExtraItem() { var arr = new[] { new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile(), new MediaFile() }; Console.WriteLine("Original: {0}", string.Join(",", arr.Select(x => x.Id))); var queue = new MediaQueue(); Console.WriteLine("Current Index: {0}", queue.Index); queue.AddRange(arr); queue.ToggleShuffle(); queue.Add(new MediaFile()); Console.WriteLine("Shuffled: {0}", string.Join(",", queue.Cast <MediaFile>().Select(x => x.Id))); queue.ToggleShuffle(); Console.WriteLine("Unshuffled: {0}", string.Join(",", queue.Cast <MediaFile>().Select(x => x.Id))); CollectionAssert.AllItemsAreUnique(queue.Cast <MediaFile>().Select(x => x.Id)); Assert.AreEqual(arr[0].Id, queue.Cast <MediaFile>().ElementAt(0).Id); Assert.AreEqual(arr[1].Id, queue.Cast <MediaFile>().ElementAt(1).Id); Assert.AreEqual(arr[2].Id, queue.Cast <MediaFile>().ElementAt(2).Id); Assert.AreEqual(arr[3].Id, queue.Cast <MediaFile>().ElementAt(3).Id); Assert.AreEqual(arr[4].Id, queue.Cast <MediaFile>().ElementAt(4).Id); Assert.AreEqual(arr[5].Id, queue.Cast <MediaFile>().ElementAt(5).Id); Assert.AreEqual(arr[6].Id, queue.Cast <MediaFile>().ElementAt(6).Id); Assert.AreEqual(arr[7].Id, queue.Cast <MediaFile>().ElementAt(7).Id); Assert.AreEqual(arr[8].Id, queue.Cast <MediaFile>().ElementAt(8).Id); Assert.AreEqual(arr[9].Id, queue.Cast <MediaFile>().ElementAt(9).Id); Assert.AreEqual(arr[10].Id, queue.Cast <MediaFile>().ElementAt(10).Id); Assert.AreEqual(arr.Length + 1, queue.Count, "The array length is different"); }
public static void VerifyOrderBook( OrderBook toVerify, TradingPair pair, ExchangeType source) { ResponseVerification.VerifyApiResult(toVerify, source); Assert.That(toVerify.Pair == pair); CollectionAssert.IsNotEmpty(toVerify.Asks); CollectionAssert.AllItemsAreNotNull(toVerify.Asks); CollectionAssert.AllItemsAreInstancesOfType(toVerify.Asks, typeof(OrderBookEntry)); CollectionAssert.AllItemsAreUnique(toVerify.Asks); CollectionAssert.DoesNotContain(toVerify.Asks, default(OrderBookEntry)); CollectionAssert.IsNotEmpty(toVerify.Bids); CollectionAssert.AllItemsAreNotNull(toVerify.Bids); CollectionAssert.AllItemsAreInstancesOfType(toVerify.Bids, typeof(OrderBookEntry)); CollectionAssert.AllItemsAreUnique(toVerify.Bids); CollectionAssert.DoesNotContain(toVerify.Bids, default(OrderBookEntry)); CollectionAssert.AreNotEqual(toVerify.Asks, toVerify.Bids); var orderedAsks = toVerify.Asks.OrderBy(x => x.Price); Assert.That(orderedAsks.SequenceEqual(toVerify.Asks)); var orderedBids = toVerify.Bids.OrderByDescending(x => x.Price); Assert.That(orderedBids.SequenceEqual(toVerify.Bids)); foreach (var entry in toVerify.Asks) { ResponseVerification.VerifyApiResult(entry, source); Assert.That(entry.Amount > 0.0m); Assert.That(entry.Price > 0.0m); Assert.That(entry.UnixTimeStamp > 0); } foreach (var entry in toVerify.Bids) { ResponseVerification.VerifyApiResult(entry, source); Assert.That(entry.Amount > 0.0m); Assert.That(entry.Price > 0.0m); Assert.That(entry.UnixTimeStamp > 0); } }
public void AllItemsTests() { object[] ints = new object[] { 1, 2, 3, 4 }; object[] doubles = new object[] { 0.99, 2.1, 3.0, 4.05 }; object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" }; // Classic syntax CollectionAssert.AllItemsAreNotNull(ints); CollectionAssert.AllItemsAreInstancesOfType(ints, typeof(int)); CollectionAssert.AllItemsAreInstancesOfType(strings, typeof(string)); CollectionAssert.AllItemsAreUnique(ints); // Helper syntax Assert.That(ints, Is.All.Not.Null); Assert.That(ints, Has.None.Null); Assert.That(ints, Is.All.InstanceOfType(typeof(int))); Assert.That(ints, Has.All.InstanceOfType(typeof(int))); Assert.That(strings, Is.All.InstanceOfType(typeof(string))); Assert.That(strings, Has.All.InstanceOfType(typeof(string))); Assert.That(ints, Is.Unique); // Only available using new syntax Assert.That(strings, Is.Not.Unique); Assert.That(ints, Is.All.GreaterThan(0)); Assert.That(ints, Has.All.GreaterThan(0)); Assert.That(ints, Has.None.LessThanOrEqualTo(0)); Assert.That(strings, Text.All.Contains("a")); Assert.That(strings, Has.All.Contains("a")); Assert.That(strings, Has.Some.StartsWith("ba")); Assert.That(strings, Has.Some.Property("Length", 3)); Assert.That(strings, Has.Some.StartsWith("BA").IgnoreCase); Assert.That(doubles, Has.Some.EqualTo(1.0).Within(.05)); // Inherited syntax Expect(ints, All.Not.Null); Expect(ints, None.Null); Expect(ints, All.InstanceOfType(typeof(int))); Expect(strings, All.InstanceOfType(typeof(string))); Expect(ints, Unique); // Only available using new syntax Expect(strings, Not.Unique); Expect(ints, All.GreaterThan(0)); Expect(ints, None.LessThanOrEqualTo(0)); Expect(strings, All.Contains("a")); Expect(strings, Some.StartsWith("ba")); Expect(strings, Some.StartsWith("BA").IgnoreCase); Expect(doubles, Some.EqualTo(1.0).Within(.05)); }
public void TestGetSortedListByNamesAndFrequency() { var domain = new ContactDomain(); var context = new Mock <AppDataContext>(); context.SetupGet(x => x.Contacts) .Returns(() => { return(new Repository <Contact>(new List <Contact>() { new Contact { FirstName = "John", LastName = "Doe" }, new Contact { FirstName = "Peter", LastName = "Botha" }, new Contact { FirstName = "Sarie", LastName = "Coetzee" }, new Contact { FirstName = "Gerrit", LastName = "de Bruin" }, new Contact { FirstName = "Jan", LastName = "vd Merwe" }, new Contact { FirstName = "Sarel", LastName = "Doe" }, new Contact { FirstName = "Koos", LastName = "Smith" }, new Contact { FirstName = "Sannie", LastName = "Smith" } })); }); IEnumerable <KeyValuePair <int, string> > result = domain.GetSortedListByNamesAndFrequency(context.Object); Assert.IsNotNull(result); CollectionAssert.AllItemsAreUnique(result.ToList()); Assert.IsTrue(result.Any(), "Returned No Resultes"); Assert.IsTrue(result.Count() == 14, "Result count mismatch"); Assert.IsTrue(result.First().Key == 2, "First element count mismatch"); Assert.IsTrue(result.First().Value == "Doe", "First element last name mismatch"); Assert.IsTrue(result.Last().Key == 1, "Last element count mismatch"); Assert.IsTrue(result.Last().Value == "vd Merwe", "Last element last name mismatch"); }
public async Task GetMultipleReferencesTest() { List <string> strings = new List <String>(); string str1 = "mælk"; string str2 = "ost"; string str3 = "salt"; strings.Add(str1); strings.Add(str2); strings.Add(str3); List <Recipe> recipes = await databaseConnect.Recipe.GetReferencesAsync(strings); Assert.IsTrue(recipes.Count > 0); CollectionAssert.AllItemsAreUnique(recipes); }
public void TestParameterCollectionOperations() { var param1 = new ClickHouseDbParameter() { ParameterName = "param1", ClickHouseType = "Int32", Value = 1 }; var param2 = new ClickHouseDbParameter() { ParameterName = "param2", ClickHouseType = "Int32", Value = 2 }; var param3 = new ClickHouseDbParameter() { ParameterName = "param3", ClickHouseType = "String", Value = "ASD" }; var param4 = new ClickHouseDbParameter() { ParameterName = "param4", ClickHouseType = "Nothing", Value = null }; var collection = new ClickHouseParameterCollection { param1 }; collection.AddRange(new[] { param2, param3 }); CollectionAssert.AllItemsAreNotNull(collection); CollectionAssert.AllItemsAreUnique(collection); Assert.AreEqual(3, collection.Count); Assert.IsTrue(collection.Contains(param2)); Assert.IsTrue(collection.Contains("param3")); collection.CopyTo(new object[collection.Count], 0); Assert.AreEqual(0, collection.IndexOf(param1)); Assert.AreEqual(2, collection.IndexOf("param3")); collection["param4"] = param4; collection.Insert(3, param2); Assert.AreEqual(param2, collection[3]); Assert.AreEqual(param4, collection["param4"]); collection.RemoveAt("param4"); collection.RemoveAt(3); collection.Remove(param2); Assert.AreEqual(2, collection.Count); collection.Clear(); Assert.AreEqual(0, collection.Count); }
public void ShouldGenerateUniqueIdsForItemsWithoutIdAddedToChain() { // Given var processingChainTemplate = new ProcessingChainTemplate { new ImageProviderTemplate(), new ImageDisplayTemplateTemplate() }; var template = new TwoPointNonUniformityCorrectionTemplate { Id = null }; // When processingChainTemplate.Insert(1, template); // Then Assert.IsNotNull(template.Id); CollectionAssert.AllItemsAreUnique(processingChainTemplate.Select(i => i.Id)); }
public void GetInstalledGamesTest() { var steamLib = CreateLibrary(); var games = steamLib.GetInstalledGames(); Assert.AreNotEqual(0, games.Count); CollectionAssert.AllItemsAreUnique(games); foreach (var game in games.Values) { Assert.IsFalse(string.IsNullOrEmpty(game.Name)); Assert.IsFalse(string.IsNullOrEmpty(game.GameId)); Assert.IsFalse(string.IsNullOrEmpty(game.InstallDirectory)); Assert.IsNotNull(game.PlayAction); Assert.IsTrue(game.PlayAction.Type == GameActionType.URL); } }
public void Generate_unique_ids_with_multiple_nodes() { int max; using (var connector = new Connector(_clientConfig)) { var ids = connector.GenerateUniqueIds("test", 13); Assert.AreEqual(13, ids.Length); CollectionAssert.AllItemsAreUnique(ids, "identifiers are not unique"); max = ids.Max(); Assert.IsTrue(ids.Min() > 0, "unique ids should be strictly positive"); } // check that after restart unique ids are bigger than the previous ones using (var connector = new Connector(_clientConfig)) { var ids = connector.GenerateUniqueIds("test", 13); Assert.AreEqual(13, ids.Length); CollectionAssert.AllItemsAreUnique(ids, "identifiers are not unique"); Assert.IsTrue(ids.Min() > max, "sequence persistence failure"); max = ids.Max(); } // ask for less than the number of nodes (10) using (var connector = new Connector(_clientConfig)) { var ids = connector.GenerateUniqueIds("test", 2); Assert.AreEqual(2, ids.Length); CollectionAssert.AllItemsAreUnique(ids, "identifiers are not unique"); Assert.IsTrue(ids.Min() > max, "sequence persistence failure"); } }
public void Unique_IList() { ArrayList al = new ArrayList(); al.Add(new object()); al.Add(new object()); al.Add(new object()); CollectionAssert.AllItemsAreUnique(al); al = new ArrayList(); al.Add("x"); al.Add("y"); al.Add("z"); CollectionAssert.AllItemsAreUnique(al); }
public void ComPluginRuntimeHandler_ListMethods_WhenValidDll_ExpectListMethods_64Bit() { //------------Setup for test-------------------------- var source = CreateComPluginSource(); source.Is32Bit = false; //------------Execute Test--------------------------- var mock = new Mock<INamedPipeClientStreamWrapper>(); var memoryStream = new MemoryStream(); var list = new List<string>() { "Home" }; memoryStream.WriteByte(Encoding.ASCII.GetBytes(list.SerializeToJsonString(new KnownTypesBinder()))[0]); mock.Setup(wrapper => wrapper.GetInternalStream()).Returns(memoryStream); var isolated = new ComPluginRuntimeHandler(mock.Object); var result = isolated.ListMethods(adodbConnectionClassId, false); //------------Assert Results------------------------- CollectionAssert.AllItemsAreUnique(result); CollectionAssert.AllItemsAreNotNull(result); }
public void GenerateTest() { // Arrange object parameter = null; int seed = 1337; int loopCount = 100; IPv4Generator ig = new IPv4Generator(); List <string> stringAddresses = new List <string>(); List <uint> uintAddresses = new List <uint>(); List <bool> successList = new List <bool>(); // Act var shouldBeValidResult = ig.Init(parameter, seed); var generated1 = ig.Generate(parameter); var generated2 = ig.Generate(parameter); // Same step should provide same result for (int i = 0; i < loopCount; i++) { ig.NextStep(); var generateResult1 = ig.Generate(parameter: null, wantedOutput: typeof(string)); var generateResult2 = ig.Generate(parameter: null, wantedOutput: typeof(uint)); successList.Add(generateResult1.success); successList.Add(generateResult2.success); stringAddresses.Add((string)generateResult1.result); uintAddresses.Add((uint)generateResult2.result); } // Assert Assert.IsTrue(shouldBeValidResult.success, "Init should have been successful"); Assert.AreEqual(generated1.result, generated2.result, "Both generates should have same results since NextStep has not been called between them"); CollectionAssert.DoesNotContain(successList, false, "All generates should have been successful"); CollectionAssert.AllItemsAreUnique(stringAddresses, "In generated addresses should be unique"); CollectionAssert.AllItemsAreUnique(uintAddresses, "In generated addresses should be unique"); Assert.AreEqual("67.94.2.170", stringAddresses[0], "Selected seed should always generate this result"); Assert.AreEqual(2852281923, uintAddresses[0], "Selected seed should always generate this result"); }
public void ScrapeMovementsForCharacter() { var character = Characters.Greninja; character.SourceUrl = $"{Keys.KHSiteBaseUrl}Smash4/{character.EscapedCharacterName}"; var movementScrapingService = new DefaultMovementScraper(_scrapingServices); var movements = movementScrapingService.GetMovementsForCharacter(character).ToList(); CollectionAssert.AllItemsAreNotNull(movements); CollectionAssert.AllItemsAreUnique(movements); CollectionAssert.IsNotEmpty(movements); movements.ForEach(movement => { AssertMovementIsValid(movement, character); }); }
public void Should_Get_User_By_Id_Including_Groups_And_Memberships() { var user = redmineManager.GetObject <User>(USER_ID, new NameValueCollection() { { RedmineKeys.INCLUDE, RedmineKeys.GROUPS + "," + RedmineKeys.MEMBERSHIPS } }); Assert.IsNotNull(user, "Get user by id returned null!"); CollectionAssert.AllItemsAreNotNull(user.Groups, "Groups contains null items."); CollectionAssert.AllItemsAreUnique(user.Groups, "Groups items are not unique."); Assert.IsTrue(user.Groups.Count == NUMBER_OF_GROUPS, "Group count != " + NUMBER_OF_GROUPS); CollectionAssert.AllItemsAreNotNull(user.Memberships, "Memberships contains null items."); CollectionAssert.AllItemsAreUnique(user.Memberships, "Memberships items are not unique."); Assert.IsTrue(user.Memberships.Count == NUMBER_OF_MEMBERSHIPS, "Membership count != " + NUMBER_OF_MEMBERSHIPS); }
public void TestSortByAddresses() { var domain = new AddressDomain(); var context = new Mock <IAppDataContext>(); context.SetupGet(x => x.Addresses) .Returns(() => { return(new Repository <Address>(new List <Address>() { new Address() { Number = 102, Street = "Long Lane" }, new Address() { Number = 65, Street = "Ambling Way" }, new Address() { Number = 82, Street = "Stewart St" }, new Address() { Number = 12, Street = "Howard St" }, new Address() { Number = 78, Street = "Short Lane" }, new Address() { Number = 49, Street = "Sutherland St" }, })); }); IEnumerable <string> result = domain.SortByStreetAndFrequency(context.Object); Assert.IsNotNull(result); CollectionAssert.AllItemsAreUnique(result.ToList()); Assert.IsTrue(result.Any(), "Returned No Resultes"); Assert.IsTrue(result.Count() == 6, "Result count mismatch"); Assert.IsTrue(result.First() == "65 Ambling Way", "First element mismatch"); Assert.IsTrue(result.Last() == "49 Sutherland St", "Last element mismatch"); }
public void RemoveWalletTest() { WalletManager walletManager = new WalletManager(); var output = walletManager.AddWallet("Test Wallet", 5.1m); Assert.AreEqual(2, output); var walletList = walletManager.GetWallets(); CollectionAssert.AllItemsAreUnique(walletList); var wallet = walletList.Last(); var result = walletManager.RemoveWallet(wallet); Assert.AreEqual(1, result); CollectionAssert.DoesNotContain(walletList, wallet); }
public async Task GetItems() { var cl = new Pr0grammClient(); var res = await cl.Item.GetItemsOlder(ItemFlags.SFW, ItemStatus.Promoted, false, null, null, null, false, 1196866).ConfigureAwait(false); Assert.NotNull(res); Assert.That(res.Items, Is.Not.Empty); Assert.AreEqual(120, res.Items.Count); CollectionAssert.AllItemsAreNotNull(res.Items); CollectionAssert.AllItemsAreUnique(res.Items); _items = res.Items; Assert.That(_items[0].ImageUrl, Does.EndWith(".png")); Assert.That(_items[1].ImageUrl, Does.EndWith(".webm")); Assert.That(_items[10].ImageUrl, Is.Not.Null.And.Not.Empty); }
public async Task Should_Get_User_By_Id_Including_Groups_And_Memberships() { var user = await redmineManager.GetObjectAsync <User>(userId, new NameValueCollection() { { RedmineKeys.INCLUDE, "groups,memberships" } }); Assert.IsNotNull(user, "Get user by id returned null!"); CollectionAssert.AllItemsAreNotNull(user.Groups, "Groups contains null items."); CollectionAssert.AllItemsAreUnique(user.Groups, "Groups items are not unique."); Assert.IsTrue(user.Groups.Count == 1, "Group count != 1"); CollectionAssert.AllItemsAreNotNull(user.Memberships, "Memberships contains null items."); CollectionAssert.AllItemsAreUnique(user.Memberships, "Memberships items are not unique."); Assert.IsTrue(user.Memberships.Count == 3, "Membership count != 3"); }
public void MembersTest() { foreach (NamespaceInfo n in actual.Namespaces) { foreach (ClassInfo c in n.Classes) { CollectionAssert.AllItemsAreNotNull(c.Methods); CollectionAssert.AllItemsAreUnique(c.Methods); CollectionAssert.AllItemsAreNotNull(c.Fields); CollectionAssert.AllItemsAreUnique(c.Fields); CollectionAssert.AllItemsAreNotNull(c.Properties); CollectionAssert.AllItemsAreUnique(c.Properties); CollectionAssert.AllItemsAreNotNull(c.Constructors); CollectionAssert.AllItemsAreUnique(c.Constructors); } } }
public void Register_Instances_Transient_Unique() { var container = Container.Create(); var instanceRedFirst = new ColorRed(); var instanceRedSecond = new ColorRed(); var instanceRedThird = new ColorRed(); container.Register(Scope.Transient, instanceRedFirst); container.Register(Scope.Transient, instanceRedSecond); container.Register(Scope.Transient, instanceRedThird); var reds = container.GetCachedMultiple <ColorRed>(); Assert.AreEqual(3, reds.Length); CollectionAssert.AllItemsAreUnique(reds); }
public void TestGetAvailableneighboors1() { Field field = new Field(10, 10); Map map = new Map(field); MapElement[] neighboors = map.GetAvailableNeighboors(map[0, 0]); MapElement[] expectedneighboors = new MapElement[] { map[1, 0], map[0, 1] }; Assert.AreEqual(neighboors.Length, 2); CollectionAssert.AllItemsAreNotNull(neighboors); CollectionAssert.AllItemsAreUnique(neighboors); CollectionAssert.AreEqual(expectedneighboors, neighboors); }
public void SampleTest() { var source = new string[] { "This", "Is", "Some", "String", "Data", "123", "456" }; using (var r = new RandomGenerator(new SystemRandomRandomnessSource())) { for (int i = 0; i < ITERATIONS; i++) { var samples = r.SampleWithoutReplacement(source, 3); CollectionAssert.AllItemsAreUnique(samples); foreach (var sample in samples) { CollectionAssert.Contains(source, sample); } } } }
public void GetInstalledGamesRegistry() { var gogLib = CreateLibrary(); var games = gogLib.GetInstalledGames(); Assert.AreNotEqual(0, games.Count); CollectionAssert.AllItemsAreUnique(games); foreach (var game in games.Values) { Assert.IsFalse(string.IsNullOrEmpty(game.Name)); Assert.IsFalse(string.IsNullOrEmpty(game.GameId)); Assert.IsFalse(string.IsNullOrEmpty(game.InstallDirectory)); Assert.IsTrue(Directory.Exists(game.InstallDirectory)); Assert.IsNotNull(game.PlayAction); } }
public void GetOddNumbers_LimitIsGreaterThanZero_ReturnOddNumbersUpToLimit() { var result = _math.GetOddNumbers(5); var expected = new[] { 1, 3, 5 }.OrderBy(i => i).ToArray(); Assert.IsNotNull(result); Assert.AreEqual(3, result.Count()); Assert.AreEqual(1, result.ToArray()[0]); Assert.AreEqual(3, result.ToArray()[1]); Assert.AreEqual(5, result.ToArray()[2]); CollectionAssert.AreEquivalent(expected, result.ToArray()); CollectionAssert.AreEqual(expected, result.OrderBy(i => i).ToArray()); CollectionAssert.AllItemsAreUnique(result.ToArray()); }
public void ScrapeAerialMovesForCharacter(WebCharacter character) { var aerialMoveScrapingService = new AerialMoveScraper(_scrapingServices); character.SourceUrl = $"{Keys.KHSiteBaseUrl}{_game}{character.EscapedCharacterName}"; var aerialMoves = aerialMoveScrapingService.Scrape(character).ToList(); CollectionAssert.AllItemsAreNotNull(aerialMoves); CollectionAssert.AllItemsAreUnique(aerialMoves); CollectionAssert.IsNotEmpty(aerialMoves); aerialMoves.ForEach(move => { AssertMoveIsValid(move, character); Assert.That(move.LandingLag, Is.Not.Null); Assert.That(move.AutoCancel, Is.Not.Null); }); }
public void PackageRepository_GetAll_Returns_All_PackageDefinitions() { var packageDefinitionList = new List <PackageDefinition> { new() { Name = "PackOne" }, new() { Name = "PackTwo" }, new() { Name = "PackThree" } }; foreach (var packageDefinition in packageDefinitionList) { CreatedPackageSchemaRepository.SavePackage(packageDefinition); } var loadedPackageDefinitions = CreatedPackageSchemaRepository.GetAll().ToList(); CollectionAssert.IsNotEmpty(loadedPackageDefinitions); CollectionAssert.AllItemsAreUnique(loadedPackageDefinitions); Assert.AreEqual(loadedPackageDefinitions.Count, 3); }
public void GetInstalledGamesGalaxy() { var gogLib = new GogLibrary(); var games = gogLib.GetInstalledGames(InstalledGamesSource.Galaxy); Assert.AreNotEqual(0, games.Count); CollectionAssert.AllItemsAreUnique(games); foreach (Game game in games) { Assert.IsFalse(string.IsNullOrEmpty(game.Name)); Assert.IsFalse(string.IsNullOrEmpty(game.ProviderId)); Assert.IsFalse(string.IsNullOrEmpty(game.InstallDirectory)); Assert.IsTrue(Directory.Exists(game.InstallDirectory)); Assert.IsNotNull(game.PlayTask); Assert.IsTrue(File.Exists(game.ResolveVariables(game.PlayTask.Path))); } }