예제 #1
0
        // ------------------------------------------------------------------------
        // Section 6.2: Working with tuples

        static void MainTuples()
        {
            // Section 6.2.1: Methods for working with tuples in C#

            var oldPrague = Tuple.Create("Prague", 1188000);
            // Direct call to the static method
            var newPrague1 = TupleExtensions.MapSecond(oldPrague, n => n + 13195);
            // Calling using extension method
            var newPrague2 = oldPrague.MapSecond(n => n + 13195);
        }
예제 #2
0
        public void AsEnumerableWithNullThis()
        {
            // ReSharper disable InvokeAsExtensionMethod

            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object, object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object, object, object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object, object, object, object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object, object, object, object, object>)null));
            AssertArgumentNullExceptionForNullThis(() => TupleExtensions.AsEnumerable((Tuple <object, object, object, object, object, object, object>)null));

            // ReSharper restore InvokeAsExtensionMethod
        }
예제 #3
0
        public async Task <List <TestNodeAssembly> > SelectTests(List <string> testAssemblies = null)
        {
            var finder = new CoveringTestsFinder();
            List <CciModuleSource> modules = (await _assembliesTask)
                                             .Where(a => testAssemblies == null || testAssemblies.Select(Path.GetFileNameWithoutExtension)
                                                    .Contains(a.Module.Name)).ToList();
            var coveringTask = finder.FindCoveringTests(modules, _matcher);

            var result = await TupleExtensions.WhenAll(Tuple.Create(coveringTask, _testsTask));

            var coveringTests = result.Item1;
            var testsRootNode = result.Item2;

            SelectOnlyCoveredTests(testsRootNode, coveringTests);

            TreeUtils.ExpandLoneNodes(testsRootNode);

            return(testsRootNode.TestNodeAssemblies.ToList());
        }