当前位置: 首页>>代码示例>>C#>>正文


C# List.Except方法代码示例

本文整理汇总了C#中NUnit.Framework.List.Except方法的典型用法代码示例。如果您正苦于以下问题:C# List.Except方法的具体用法?C# List.Except怎么用?C# List.Except使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NUnit.Framework.List的用法示例。


在下文中一共展示了List.Except方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Drivers

        public void Drivers()
        {
            var letters = new List<string>();

            for (var letter = 'D'; letter <= 'Z'; letter++)
            {
                letters.Add(letter + ":\\");
                Console.Write(letter + " ");
            }

            Console.WriteLine();

            var drives = DriveInfo.GetDrives().Select(x => x.Name);

            foreach (var drive in drives)
            {
                Console.Write(drive + " ");
            }

            Console.WriteLine();

            foreach (var l in letters.Except(drives))
            {
                Console.Write(l + " ");
            }
        }
开发者ID:iivchenko,项目名称:SandBox,代码行数:26,代码来源:FileSystem.cs

示例2: CanApplyLocalCopyOfFullMasterDataUpdate

        public void CanApplyLocalCopyOfFullMasterDataUpdate()
        {
            //Given 
            var zipStreamProcesser = new FakeZipStreamProcesser(FullMasterUpdatePath);
            var masterDataUpdater = new MasterDataUpdater(Database, zipStreamProcesser);
            
            //When
            var result = masterDataUpdater.ApplyUpdate(false, default(Stream));
            
            //Then
            CheckResult(result);
            
            var actualTableNames = new List<string>();
            var emptyTables = new List<string>();

            foreach (var entity in DatabaseConfig.GetMasteDataTypes())
            {                
                var tableName = Database.GetTableName(entity);              
                actualTableNames.Add(tableName);

                var count = Database.Count(entity);
                if (count == 0) emptyTables.Add(tableName);
            }

            var fail = CheckEmpty("Local Tables that have no rows:\n{0}", emptyTables);

            var difference = actualTableNames.Except(zipStreamProcesser.TableNames);
            fail +=  CheckEmpty("Local Tables that have no Master Data CSV File:\n{0}", difference);

            difference = zipStreamProcesser.TableNames.Except(actualTableNames);
            fail += CheckEmpty("Master Data CSV Files without Local Tables:\n {0}", difference);

            Assert.IsTrue(fail == 0, "\n\nOne or more errors occurred");
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:34,代码来源:MasterDataUpdaterTest.cs

示例3: GetDefaultQualities

        public static List<QualityProfileItem> GetDefaultQualities(params Quality[] allowed)
        {
            var qualities = new List<Quality>
            {
                Quality.SDTV,
                Quality.WEBDL480p,
                Quality.DVD,
                Quality.HDTV720p,
                Quality.HDTV1080p,
                Quality.RAWHD,
                Quality.WEBDL720p,
                Quality.Bluray720p,
                Quality.WEBDL1080p,
                Quality.Bluray1080p
            };

            if (allowed.Length == 0)
                allowed = qualities.ToArray();

            var items = qualities
                .Except(allowed)
                .Concat(allowed)
                .Select(v => new QualityProfileItem { Quality = v, Allowed = allowed.Contains(v) }).ToList();

            return items;
        }
开发者ID:Kiljoymccoy,项目名称:NzbDrone,代码行数:26,代码来源:QualityFixture.cs

示例4: AllPropertyNames

        public void AllPropertyNames()
        {
            List<string> propertyNames = new List<string>();
            List<string> excludedNames = new List<string>();
            foreach (var file in Directory.EnumerateFiles(Path.GetFullPath(RelativePathToSchemaDir)))
            {
                if (!file.EndsWith("schema.json"))
                {
                    continue;
                }

                var contents = ReadContents(file);
                var reader = new JsonTextReader(new StringReader(contents));
                while (reader.Read())
                {
                    if (reader.TokenType != JsonToken.PropertyName) continue;
                    propertyNames.Add((string)reader.Value);
                }

                var result = JsonConvert.DeserializeObject<Schema>(contents);
                if (result.Properties != null)
                {
                    foreach (var key in result.Properties.Keys)
                    {
                        excludedNames.Add(key.ToLower());
                    }
                }
            }
            propertyNames = propertyNames.Select((p) => p.ToLower()).Distinct().ToList();
            var knownPropertyNames = typeof (Schema).GetProperties().Select((p) => p.Name.ToLower());
            propertyNames = propertyNames.Except(knownPropertyNames).Except(excludedNames)
                .Except(new[] { "$schema", "__ref__", "additionalproperties", "gltf_webgl", "gltf_detaileddescription", "gltf_enumnames", "gltf_uritype" }).ToList();
            
            CollectionAssert.AreEquivalent(new string[] {}, propertyNames);
        }
开发者ID:lokeuei,项目名称:glTF,代码行数:35,代码来源:SchemaTest.cs

示例5: given_a_string_constructs_a_correct_PackageNode

 public void given_a_string_constructs_a_correct_PackageNode(string input, string package,
     List<string> dependencies)
 {
     PackageDefinition packageDef = new PackageDefinition(input);
     Assert.AreEqual(packageDef.Package, package);
     Assert.IsFalse(dependencies.Except(packageDef.Dependencies).Any());
     Assert.IsFalse(packageDef.Dependencies.Except(dependencies).Any());
 }
开发者ID:hmonzer,项目名称:PackageInstaller,代码行数:8,代码来源:PackageDefinitionTests.cs

示例6: LogicEqualityComparerLinqExcept

 public void LogicEqualityComparerLinqExcept()
 {
     var people = new List<Person>() { _abe, _joe1, _sue, _joe2 };
     var peopleWhoAreJoe = new List<Person>() { _joe1 };
     var comparer = new LogicEqualityComparer<Person>();
     var peopleWhoAreNotJoe = people.Except(peopleWhoAreJoe, comparer);
     Assert.IsTrue(peopleWhoAreNotJoe.Count() == 2);
     Assert.IsFalse(peopleWhoAreNotJoe.Where(p => p.Name == "Joe").Any());
 }
开发者ID:GregFinzer,项目名称:Compare-Net-Objects,代码行数:9,代码来源:LogicEqualityComparerTests.cs

示例7: Subset

        public void Subset()
        {
            var a = new List<int> { 1, 2, 3 };
            var b = new List<int> { 1, 2, 5, 3, 4, 3, 6 };

            var result = !a.Except(b).Any();

            Assert.IsTrue(result);
        }
开发者ID:korz,项目名称:MathIsEverywhere,代码行数:9,代码来源:IntegerTests.cs

示例8: LogicEqualityComparerDeepLinqExcept

 public void LogicEqualityComparerDeepLinqExcept()
 {
     var group1 = new KeyValuePair<string, List<Person>>("People", new List<Person>() { _abe });
     var group2 = new KeyValuePair<string, List<Person>>("People", new List<Person>() { _sue });
     var groups = new List<KeyValuePair<string, List<Person>>>() { group1, group2 };
     var groupsWithJoe = new List<KeyValuePair<string, List<Person>>>() { group1 };
     var groupsWithoutJoe = groups.Except(groupsWithJoe, _typedComparer);
     Assert.IsTrue(groupsWithoutJoe.Count() == 1);
     Assert.IsTrue(groupsWithoutJoe.First().Value.First().Name == "Sue");
 }
开发者ID:GregFinzer,项目名称:Compare-Net-Objects,代码行数:10,代码来源:LogicEqualityComparerTests.cs

示例9: ShouldNotFinishUntilAllMatchesPlayed

        public void ShouldNotFinishUntilAllMatchesPlayed()
        {
            var leagueSeason = A.LeagueSeason.Build();

            var fixtures = new List<Fixture>();
            leagueSeason.ScheduleFixtures(f => fixtures.Add(f));

            var allFixturesExceptLast = fixtures.Except(fixtures.Last().AsEnumerable()).ToList();
            allFixturesExceptLast.ForEach(f => leagueSeason.ApplyResult(A.MatchResult.ForFixture(f).Build()));

            Assert.That(leagueSeason.IsFinished, Is.False);
        }
开发者ID:MilenPavlov,项目名称:EuroManager,代码行数:12,代码来源:LeagueSeasonTests.cs

示例10: Difference

        public void Difference()
        {
            var a = new List<int> { 1, 2, 3 };
            var b = new List<int> { 1, 2, 3, 4, 5, 6 };

            var results = b.Except(a).ToList();

            Assert.AreEqual(3, results.Count());
            Assert.AreEqual(4, results[0]);
            Assert.AreEqual(5, results[1]);
            Assert.AreEqual(6, results[2]);
        }
开发者ID:korz,项目名称:MathIsEverywhere,代码行数:12,代码来源:IntegerTests.cs

示例11: Categories_That_Do_Not_Have_Certain_Products

        public void Categories_That_Do_Not_Have_Certain_Products()
        {
            List<int> prod = new List<int>() { 1, 2 };

            var expected = "[{\"CategoryID\":2},{\"CategoryID\":3},{\"CategoryID\":4},{\"CategoryID\":5},{\"CategoryID\":6},{\"CategoryID\":7},{\"CategoryID\":8}]";

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from
                        cat in context.Categories
                    where
                        prod.Except(cat.Products.Select(x => x.ProductID))
                            .Count() > 0
                    select
                        cat.CategoryID,
                expected);

            Assert.IsTrue(result.Check());
        }
开发者ID:CodingGorilla,项目名称:effort,代码行数:19,代码来源:ComplexQueryFixture.cs

示例12: RandomShufflerShouldNotChangeReffernceTypeListContentOtherThanOrder

        public void RandomShufflerShouldNotChangeReffernceTypeListContentOtherThanOrder()
        {
            const int listSize = 4;
            var list = new List<string>()
            {
                "This",
                "is",
                "a",
                "Test"
            };
            var listClone = new List<string>(list);
            ListRandomShuffler.InPlaceShuffle(list);

            var dupCount = list.Intersect(listClone).ToList().Count;
            Assert.AreEqual(dupCount, listSize);

            bool hasDifference = list.Except(listClone).ToList().Any();
            Assert.IsFalse(hasDifference);
        }
开发者ID:7FeiW,项目名称:PandellListRandomShuffler,代码行数:19,代码来源:ListRandomShufflerTests.cs

示例13: CanCompareOldIdsWithNewIdsAndReturnNewIdsOnly

        public void CanCompareOldIdsWithNewIdsAndReturnNewIdsOnly()
        {
            // Arrange
            const int expectedNewId = 12345;

            var oldIds = new List<int> { 123, 1234, 123456, 1233 };
            var newIds = new List<int> { 123, 1234, expectedNewId };

            // Act
            var mergedIds = new List<int>();
            mergedIds.AddRange(oldIds);
            mergedIds.AddRange(newIds);

            IList<int> except = mergedIds.Except(oldIds).ToList();

            // Assert
            Assert.That(except, Is.Not.Null);
            Assert.That(except.Count(), Is.EqualTo(1));
            Assert.That(except.SingleOrDefault(), Is.EqualTo(expectedNewId));
        }
开发者ID:srn,项目名称:boligscraper.cs,代码行数:20,代码来源:BoligScraperTests.cs

示例14: StringebisShedareba

        public void StringebisShedareba()
        {
            var l1 = new List<string>(){"a", "b", "c", "d", "f"};
            var l2 = new List<string>(){"d", "c","b"};
            List<string> lNew = l1.Except(l2, StringComparer.OrdinalIgnoreCase).ToList();

            Console.WriteLine(lNew.Count);
            //Intersect saertoebi, Except - gansxvaveba
            foreach (var variable in lNew)
            {
                Console.WriteLine(variable);
            }

            Console.WriteLine(" **************************** ");
            lNew.Remove("f");
            foreach (var variable in lNew)
            {
                Console.WriteLine(variable);
            }
        }
开发者ID:zurabbat,项目名称:Bilingi,代码行数:20,代码来源:Test.cs

示例15: The_dependencies_should_include_referenced_complex_types_and_groups

        public void The_dependencies_should_include_referenced_complex_types_and_groups()
        {
            RelationshipsSchemaVisitor visitor = new RelationshipsSchemaVisitor(_schemaSet);
            visitor.Visit(_schema);

            List<Edge<string>> expectedList = new List<Edge<string>>
                                                  {
                                                      new Edge<string>("equity", "EquityAsset"),
                                                      new Edge<string>("EquityAsset", "ExchangeTraded"),
                                                      new Edge<string>("ExchangeTraded", "UnderlyingAsset"),
                                                      new Edge<string>("UnderlyingAsset", "IdentifiedAsset"),
                                                      new Edge<string>("IdentifiedAsset", "Asset"),
                                                      new Edge<string>("ExchangeTraded", "ExchangeIdentifier.model"),
                                                      new Edge<string>("equity", "underlyingAsset"),
                                                      new Edge<string>("underlyingAsset", "Asset"),
                                                  };

            var missingEdges = expectedList.Except(visitor.NodeEdges);
            Assert.That(visitor.NodeEdges, Is.EquivalentTo(expectedList));
        }
开发者ID:EdenRidgway,项目名称:XsdModellingHelper,代码行数:20,代码来源:Specs_for_ReferenceSchemaVisitor.cs


注:本文中的NUnit.Framework.List.Except方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。