public void TestAllWithLocalCollection()
        {
            // get all customers with a name that contains both 'm' and 'd'  (don't use vowels since these often depend on collation)
            string[] patterns = new[] { "m", "d" };

            var list = db.Customers.Where(c => patterns.All(p => c.ContactName.Contains(p))).Select(c => c.ContactName).ToList();
            var local = db.Customers.AsEnumerable().Where(c => patterns.All(p => c.ContactName.ToLower().Contains(p))).Select(c => c.ContactName).ToList();

            AssertValue(local.Count, list.Count);
        }
 public void Generate_CallsPropertyGeneratorsForAllProperties()
 {
     var spies = new[] {new SpyGenerator(), new SpyGenerator()};
     var memberGenerators = spies.Cast<CodeGeneratorBase>().ToArray();
     var generator = new PropertiesGenerator(null, memberGenerators);
     generator.Generate(type, contentType);
     Assert.That(spies.All(spy => spy.Called));
     Assert.That(
         spies.All(spy =>
             spy.CodeObjects.SequenceEqual(
                 type.Members.OfType<CodeMemberProperty>()
             )
         )
     );
 }
Exemplo n.º 3
0
        public void Clear_ShouldDisposeAllDisposables()
        {
            var firstOverrideDisposable = new SomeDisposable();
            var secondOverrideDisposable = new SomeDisposable();
            var firstDefaultDisposable = new SomeDisposable();
            var secondDefaultDisposable = new SomeDisposable();

            var all = new[]
            {
                firstDefaultDisposable,
                secondDefaultDisposable,
                firstOverrideDisposable,
                secondOverrideDisposable
            };

            var settings = new SettingsHolder();
            settings.Set("1.Override", firstOverrideDisposable);
            settings.Set("2.Override", secondOverrideDisposable);
            settings.SetDefault("1.Default", firstDefaultDisposable);
            settings.SetDefault("2.Default", secondDefaultDisposable);

            settings.Clear();

            Assert.IsTrue(all.All(x => x.Disposed));
        }
Exemplo n.º 4
0
		public static void PathEquals(this Uri u, string pathAndQueryString)
		{
			var paths = (pathAndQueryString ?? "").Split(new[] { '?' }, 2);

			string path = paths.First(), query = string.Empty;
			if (paths.Length > 1)
				query = paths.Last();

			var expectedUri = new UriBuilder("http", "localhost", u.Port, path, "?" + query).Uri;

			u.AbsolutePath.Should().Be(expectedUri.AbsolutePath);
			u = new UriBuilder(u.Scheme, u.Host, u.Port, u.AbsolutePath, u.Query.Replace("pretty=true&", "").Replace("pretty=true", "")).Uri;

			var queries = new[] { u.Query, expectedUri.Query };
			if (queries.All(string.IsNullOrWhiteSpace)) return;
			if (queries.Any(string.IsNullOrWhiteSpace))
			{
				queries.Last().Should().Be(queries.First());
				return;
			}

			var clientKeyValues = u.Query.Substring(1).Split('&')
				.Select(v => v.Split('='))
				.Where(k => !string.IsNullOrWhiteSpace(k[0]))
				.ToDictionary(k => k[0], v => v.Last());
			var expectedKeyValues = expectedUri.Query.Substring(1).Split('&')
				.Select(v => v.Split('='))
				.Where(k => !string.IsNullOrWhiteSpace(k[0]))
				.ToDictionary(k => k[0], v => v.Last());

			clientKeyValues.Count.Should().Be(expectedKeyValues.Count);
			clientKeyValues.Should().ContainKeys(expectedKeyValues.Keys.ToArray());
			clientKeyValues.Should().Equal(expectedKeyValues);
		}
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var cubeSize = int.Parse(Console.ReadLine());
            var totalPositions = cubeSize * cubeSize * cubeSize;
            var thatFunkyDimension = new Dictionary<string, long>();

            string input;
            while ((input = Console.ReadLine()) != "Analyze")
            {
                var parameters = input.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                var position = parameters[0] + parameters[1] + parameters[2];
                var coordinates = new[] { int.Parse(parameters[0]), int.Parse(parameters[1]), int.Parse(parameters[2]) };

                if (coordinates.All(c => c >= 0 && c < cubeSize))
                {
                    var amount = int.Parse(parameters[3]);
                    if (amount != 0)
                    {
                        thatFunkyDimension[position] = amount;
                    }
                }
            }

            long sum = 0;
            foreach (var position in thatFunkyDimension)
            {
                sum += position.Value;
            }

            Console.WriteLine(sum);
            Console.WriteLine(totalPositions - thatFunkyDimension.Count);
        }
Exemplo n.º 6
0
    public bool TrySetExecutionPolicyToUnrestricted()
    {
        // Allows scripts to be run for this process
        using (var pipeline = runSpace.CreatePipeline())
        {
            var psExecutionPolicyScript = @"
                    try 
                    {
                        Set-ExecutionPolicy -ExecutionPolicy unrestricted -Scope Process -Force  -ErrorAction SilentlyContinue
                    } 
                    catch {
                    }
                    $global:EffectiveExecutionPolicy = (Get-ExecutionPolicy) -as [string]
            ";

            pipeline.Commands.AddScript(psExecutionPolicyScript);
            pipeline.Invoke();
            var psExecutionPolicy = runSpace.SessionStateProxy.GetVariable("EffectiveExecutionPolicy").ToString();

            var psLockedDownStates = new[]
                {
                    "Restricted",
                    "AllSigned"
                };
            //Powershell has been locked down via Group Policy, Platform Installer can not execute scripts
            return psLockedDownStates.All(p => p != psExecutionPolicy);
        }
    }
Exemplo n.º 7
0
        public void EigenUpdateWithoutUpdateURL()
        {
            string dir;
            string outDir;

            using (Utility.WithTempDirectory(out outDir))
            using (IntegrationTestHelper.WithFakeInstallDirectory(out dir)) {
                var di = new DirectoryInfo(dir);
                var progress = new Subject<int>();

                var bundledRelease = ReleaseEntry.GenerateFromFile(di.GetFiles("*.nupkg").First().FullName);
                var fixture = new InstallManager(bundledRelease, outDir);
                var pkg = new ZipPackage(Path.Combine(dir, "SampleUpdatingApp.1.1.0.0.nupkg"));

                var progressValues = new List<int>();
                progress.Subscribe(progressValues.Add);

                fixture.ExecuteInstall(dir, pkg, progress);

                var filesToLookFor = new[] {
                    "SampleUpdatingApp\\app-1.1.0.0\\SampleUpdatingApp.exe",
                    "SampleUpdatingApp\\packages\\RELEASES",
                    "SampleUpdatingApp\\packages\\SampleUpdatingApp.1.1.0.0.nupkg",
                };

                filesToLookFor.All(x => File.Exists(Path.Combine(outDir, x))).ShouldBeTrue();

                // Progress should be monotonically increasing
                progressValues.Count.ShouldBeGreaterThan(2);
                progressValues.Zip(progressValues.Skip(1), (prev, cur) => cur - prev).All(x => x > 0).ShouldBeTrue();
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            const string root = @"C:\Users\sp\Source\Repos\ChangeTracking\Source";
            var excluded = new[] { @"\obj", @"\bin", @"\Properties", ".vs", @"\packages" };

            Func<string, bool> isIncluded = (name) => excluded.All(e => !name.Contains(e));

            var path = new DirectoryInfo(root)
                .GetDirectories("*", SearchOption.AllDirectories)
                .Select(di => di.FullName)
                .Where(isIncluded)
                .SelectMany(Directory.GetFiles)
                .ToList();

            XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003";
            var csproj = path.Where(p => Path.GetExtension(p) == ".csproj");
            var used = csproj
                .Select(XElement.Load)
                .Elements(ns + "ItemGroup")
                .Elements(ns + "Compile")
                .Attributes("Include")
                .Select(a => a.Value)
                .Where(isIncluded)
                .Select(Path.GetFileName);

            var cs = path
                .Where(p => Path.GetExtension(p) == ".cs")
                .Select(Path.GetFileName);

            var unused = cs.Except(used);
            unused.ToList().ForEach(Console.WriteLine);
        }
        private bool IsTrueish(string value) {
            if (String.IsNullOrWhiteSpace(value))
                return false;

            var falseValues = new[] {"false", "off", "no"};
            return falseValues.All(x => !String.Equals(x, value, StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 10
0
        public void AllTest()
        {
            //Arrange
            var bst = new BinarySearchTree<int, string>();
            var testData = new[]
            {
                new KeyValuePair<int, string>(5, "A"),
                new KeyValuePair<int, string>(3, "B"),
                new KeyValuePair<int, string>(6, "C"),
                new KeyValuePair<int, string>(2, "D"),
                new KeyValuePair<int, string>(7, "E"),
                new KeyValuePair<int, string>(4, "F"),
            };

            //Act
            testData.All(t =>
            {
                bst.Add(t.Key, t.Value);
                return true;
            });
            var resultList = bst.All().ToList();

            //Assert
            Assert.AreEqual(resultList.Count, 6);

            Assert.AreEqual(resultList[0].Key, 2);
            Assert.AreEqual(resultList[1].Key, 3);
            Assert.AreEqual(resultList[2].Key, 4);
            Assert.AreEqual(resultList[3].Key, 5);
            Assert.AreEqual(resultList[4].Key, 6);
            Assert.AreEqual(resultList[5].Key, 7);
        }
Exemplo n.º 11
0
        public void Partition_sequence_returns_sequence_with_duplicates()
        {
            // Fixture setup
            var expectedSequence = new[]
                {
                    new KeyValuePair<string, IEnumerable<string>>("i", new[] {"10", "10", "30", "40"}) 
                };
            var specs =new[]
                {
                    new OptionSpecification(string.Empty, "stringvalue", false, string.Empty, Maybe.Nothing<int>(), Maybe.Nothing<int>(), '\0', null, string.Empty, string.Empty, new List<string>(), typeof(string), TargetType.Scalar),
                    new OptionSpecification("i", string.Empty, false, string.Empty, Maybe.Just(3), Maybe.Just(4), '\0', null, string.Empty, string.Empty, new List<string>(), typeof(IEnumerable<int>), TargetType.Sequence)
                };

            // Exercize system 
            var result = TokenPartitioner.Partition(
                new[] { Token.Name("i"), Token.Value("10"), Token.Value("10"), Token.Value("30"), Token.Value("40") },
                name => TypeLookup.FindTypeDescriptorAndSibling(name, specs, StringComparer.InvariantCulture)
                );

            // Verify outcome
            var options = result.Item1;
            Assert.True(expectedSequence.All(a => options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));

            // Teardown
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (Directory.Exists(args[0]))
                {
                    var pathsToNotScan = new[]
                    {
                        Path.Combine(args[0], ".git"),
                        Path.Combine(args[0], "bin"),
                        Path.Combine(args[0], "obj"),
                    };

                    var oneHourAgoInUtc = DateTime.UtcNow.AddHours(-1);
                    var recentlyWrittenThresholdInUtc = oneHourAgoInUtc;
                    var recentlyWrittenFiles = Directory.EnumerateFiles(args[0], "*", SearchOption.AllDirectories)
                                                        .Where(f => pathsToNotScan.All(p => !f.StartsWith(p)))
                                                        .Where(f => new FileInfo(f).LastWriteTimeUtc > recentlyWrittenThresholdInUtc)
                                                        .OrderByDescending(f => new FileInfo(f).LastWriteTimeUtc)
                                                        .ToArray()
                        ;
                    Application.Run(new MainForm(recentlyWrittenFiles));
                }
                else
                {
                    Application.Run(new MainForm(args));
                }
            }
            else
            {
                Application.Run(new MainForm());
            }
        }
        public override bool Execute()
        {
            try
            {
                var inputTimes = new[] { AssemblyPath }
                    .Concat(Inputs ?? NoInputs)
                    .Select(File.GetLastWriteTimeUtc)
                    .ToArray();
                var outputTime = File.GetLastWriteTimeUtc(Path.Combine(OutputDir, OutputFilename));

                if (inputTimes.All(x => x <= outputTime))
                    return true;

                var domain = AppDomain.CreateDomain("GenerateCodeDomain");
                try
                {
                    var generator = (ICodeGenerator)domain.CreateInstanceFromAndUnwrap(AssemblyPath, GeneratorName);
                    string include;
                    var result = generator.Generate(Parameters, Inputs, OutputDir, OutputFilename, Log, out include);
                    Include = include;
                    return result;
                }
                finally
                {
                    AppDomain.Unload(domain);
                }
            }
            catch (Exception x)
            {
                Log.LogErrorFromException(x);
                return false;
            }
        }
Exemplo n.º 14
0
        public void GetServiceLocator_HasAllExpectedServices()
        {
            // Given
            var expectedServices = new[] { typeof(IUnitOfWork), typeof(IRepository<Post>) };

            // Then
            Assert.True(expectedServices.All(s => ServiceLocator.Current.GetService(s) != null));
        }
Exemplo n.º 15
0
        public void TestAllWithLocalCollection()
        {
            string[] patterns = new[] { "a", "e" };

            TestQuery(
                this.Northwind.Customers.Where(c => patterns.All(p => c.ContactName.Contains(p)))
                );
        }
 public void CallsMemberGenerators()
 {
     var spies = new[]{new SpyGenerator(), new SpyGenerator()};
     var memberGenerators = spies.Cast<CodeGeneratorBase>().ToArray();
     Generator = new NamespaceGenerator(Configuration, memberGenerators);
     Generator.Generate(compileUnit, ContentType);
     Assert.That(spies.All(s => s.Called));
 }
        public void ForEach_Should_Call_The_Specified_Method_Each_Item()
        {
            var array = new[] { "Item 1", "Item2" };
            var called = new[] { false, false };

            array.ForEach(i => called[Array.IndexOf(array, i)] = true);

            Assert.IsTrue(called.All(c => c));
        }
        public void LaunchAppPassesAllProvidedParametersToProcessProxy()
        {
            var processProxyMock = MockRepository.GenerateMock<IProcessProxy>();
            var steamProxy = new CommandLineSteamProxy(processProxyMock, "test");
            var parameters = new[] { "one", "two", "three", "four" };
            steamProxy.LaunchApp(15, parameters);

            processProxyMock.AssertWasCalled(x => x.Start(Arg<string>.Is.Anything, Arg<string>.Matches(args => parameters.All(p => args.Contains(p)))), c => c.Repeat.Once());
        }
Exemplo n.º 19
0
 public string[] ExtractCommands( string line )
 {
     line = line.Trim();
     var ignorelist = new[] { "A", "B", "LATEST" };
     if( ignorelist.All( ignore =>
             !line.StartsWith( ignore, StringComparison.InvariantCultureIgnoreCase )
             && !line.StartsWith( ignore, StringComparison.InvariantCultureIgnoreCase ) ) )
         line = "latest." + line;
     return line.Split( new[] { '.' }, StringSplitOptions.RemoveEmptyEntries );
 }
Exemplo n.º 20
0
        public void script_files_with_matching_environment_are_returned()
        {
            MockFilesystem.Setup(m => m.GetFiles(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(new[] { "03_c.notmatching.sql", "01_a.notmatching.sql", "26_z.environment.sql", "05_e.notmatching.sql" });

            var scriptFiles = Scanner.Scan(Some.Value("folder"), Some.Value("environment")).ToList();
            var expectedScripts = new[] { "26_z.environment.sql" };

            Assert.That(scriptFiles.Count, Is.EqualTo(expectedScripts.Count()));
            Assert.That(expectedScripts.All(e => scriptFiles.Any(s => s.Name.Equals(e))));
        }
Exemplo n.º 21
0
        public void ConstructorShouldCopySequence()
        {
            // arrange
            var expected = new[] { "1", "2", "3" };

            // act
            var target = new ObservableQueue<string>( expected );

            // assert
            Assert.Equal( 3, target.Count );
            Assert.True( expected.All( i => target.Contains( i ) ) );
        }
Exemplo n.º 22
0
 private static void SetBbsAddress(Dictionary<string, string> p)
 {
     var sslValues = new[] { "BBS_CA_FILE", "BBS_CLIENT_CERT_FILE", "BBS_CLIENT_KEY_FILE" };
     if (sslValues.All(keyName => p.ContainsKey(keyName) && !string.IsNullOrWhiteSpace(p[keyName])))
     {
         p["BBS_ADDRESS"] = "https://bbs.service" + CONSUL_DNS_SUFFIX + ":8889";
     }
     else
     {
         p["BBS_ADDRESS"] = "http://bbs.service" + CONSUL_DNS_SUFFIX + ":8889";
     }
 }
Exemplo n.º 23
0
        public void ToAmericanDate__A_Date_Can_Be_Converted_To_American_Format()
        {
            var date = new DateTime(2000, 1, 1);
            var results = new[]
            {
                date.ToAmericanDate(false, false) == "January 1, 2000",
                date.ToAmericanDate(true, false) == "Jan 1, 2000",
                date.ToAmericanDate(true, true) == "Jan 01, 2000",
                date.ToAmericanDate(false, true) == "January 01, 2000"
            };

            Assert.IsTrue(results.All(r => r));
        }
Exemplo n.º 24
0
        public void ToEuropeanDate__A_Date_Can_Be_Converted_To_European_Format()
        {
            var date = new DateTime(2000, 1, 1);
            var results = new[]
            {
                date.ToEuropeanDate(false, false) == "1 January 2000",
                date.ToEuropeanDate(true, false) == "1 Jan 2000",
                date.ToEuropeanDate(true, true) == "01 Jan 2000",
                date.ToEuropeanDate(false, true) == "01 January 2000"
            };

            Assert.IsTrue(results.All(r => r));
        }
Exemplo n.º 25
0
        public void IsValidEmail()
        {
            var validAddresses = new[]
                                   {
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "hasApostrophe.o'*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "[email protected]",
                                       "[email protected]:25",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "*****@*****.**",
                                       "&*=?^+{}'[email protected]",
                                       "*****@*****.**"
                                   };

            var invalidAddresses = new[]
                                       {
                                           "[email protected]",
                                           "@missingLocal.org",
                                           "missingatSign.net",
                                           "missingDot@com",
                                           "two@@signs.com",
                                           "[email protected]:",
                                           "",
                                           "[email protected]",
                                           "*****@*****.**",
                                           "*****@*****.**",
                                           "*****@*****.**",
                                           "*****@*****.**",
                                           "*****@*****.**",
                                           "[email protected]",
                                           "missingTLD@domain.",
                                           "! \"#$%(),/;<>[]`|@invalidCharsInLocal.org",
                                           "invalidCharsInDomain@! \"#$%(),/;<>_[]`|.org",
                                           "*****@*****.**"
                                       };

            Assert.IsTrue(validAddresses.All(s => s.IsValidEmail()) );
            Assert.IsTrue(invalidAddresses.All(s => !s.IsValidEmail()));
        }
 public void TransformAddsItemsToTrackers()
 {
     // Fixture setup
     var sut = new DisposableTrackingBehavior();
     // Exercise system
     var trackers = new[]
     {
         sut.Transform(new DelegatingSpecimenBuilder()),
         sut.Transform(new DelegatingSpecimenBuilder()),
         sut.Transform(new DelegatingSpecimenBuilder())
     };
     // Verify outcome
     Assert.True(trackers.All(sb => sut.Trackers.Any(dt => sb == dt)));
     // Teardown
 }
Exemplo n.º 27
0
        public void EnumerableTest()
        {
            using (var file = new TempFile())
            using (var db = new LiteDatabase(file.Filename))
            {
                var col = db.GetCollection<User>("Users");

                col.EnsureIndex(x => x.Name, true);
                col.EnsureIndex(x => x.Age);

                col.Insert(new[] { new User() { Id = 1, Name = "John Smith", Age = 10 },
                                   new User() { Id = 2, Name = "Jane Smith", Age = 12 },
                                   new User() { Id = 3, Name = "John Doe", Age = 24 },
                                   new User() { Id = 4, Name = "Jane Doe", Age = 42 } });

                var empty = new string[] { };
                Assert.AreEqual(0, col.Count(user => empty.All(name => user.Name.Contains(name))));
                Assert.AreEqual(0, col.Count(user => empty.Any(name => user.Name.Contains(name))));

                var firstNames = new[] { "John", "Jane", "Jon", "Janet" };
                Assert.AreEqual(0, col.Count(user => firstNames.All(name => user.Name.StartsWith(name))));
                Assert.AreEqual(4, col.Count(user => firstNames.Any(name => user.Name.StartsWith(name))));

                var surnames = new[] { "Smith", "Doe", "Mason", "Brown" };
                Assert.AreEqual(0, col.Count(user => surnames.All(name => user.Name.Contains(name))));
                Assert.AreEqual(4, col.Count(user => surnames.Any(name => user.Name.Contains(name))));

                var johnSmith = new[] { "John", "Smith" };
                Assert.AreEqual(1, col.Count(user => johnSmith.All(name => user.Name.Contains(name))));
                Assert.AreEqual(3, col.Count(user => johnSmith.Any(name => user.Name.Contains(name))));

                var janeDoe = new[] { "Jane", "Doe" };
                Assert.AreEqual(1, col.Count(user => janeDoe.All(name => user.Name.Contains(name))));
                Assert.AreEqual(3, col.Count(user => janeDoe.Any(name => user.Name.Contains(name))));

                var numRange = new[] { new { Min = 10, Max = 12 },
                                       new { Min = 21, Max = 33 } };
                var numQuery = numRange.Select(num => Query.And(Query.GTE("Age", num.Min), Query.LTE("Age", num.Max)));
                var queryResult = col.Find(numQuery.Aggregate((lhs, rhs) => Query.Or(lhs, rhs)));
                var lambdaResult = col.Find(p => numRange.Any(num => p.Age >= num.Min && p.Age <= num.Max));

                var seq1 = queryResult.OrderBy(u => u.Name);
                var seq2 = lambdaResult.OrderBy(u => u.Name);

                Assert.IsTrue(queryResult.OrderBy(u => u.Name).SequenceEqual(lambdaResult.OrderBy(u => u.Name)));
            }
        }
Exemplo n.º 28
0
        static void Main(string[] args)
        {
            var path = @"D:\dev\EntityFramework";

            var excluded = new[] { @"\obj\Debug", @"\bin\Debug", @"\Properties" };
            Func<string, bool> isIncluded = (name) => excluded.All(e => !name.Contains(e));
            Func<DirectoryInfo, bool> witoutFiles = (di) => !di.GetFiles().Any();
            Func<DirectoryInfo, bool> witoutSubDir = (di) => !di.GetDirectories().Any();

            var dirs = new DirectoryInfo(path)
                .GetDirectories("*", SearchOption.AllDirectories)
                .Where(witoutFiles)
                .Where(witoutSubDir)
                .Select(di => di.FullName)
                .Where(isIncluded);

            dirs.ToList().ForEach(Console.WriteLine);
        }
Exemplo n.º 29
0
        public override void Test(Row row, Errors errors)
        {
            var requiredColumns = new[] { "1_3_RATING_YEAR_USED", "1_3_YEARS_OF_DATA", "1YR_YEARS_OF_DATA", "3YR_YEARS_OF_DATA" };
            if (requiredColumns.All(c => !AssertDefined(row, c, errors)))
            {
                return;
            }

            var year = DateTime.Now.Year;
            var expectedOneYear = OneYear(year);
            var expectedThreeYear = ThreeYear(year);

            var oneYear = row["1_3_RATING_YEAR_USED"] == "1 Year" && row["1_3_YEARS_OF_DATA"] == expectedOneYear;
            var threeYear = row["1_3_RATING_YEAR_USED"] == "3 Year" && row["1_3_YEARS_OF_DATA"] == expectedThreeYear;

            AssertTrue(row, oneYear || threeYear, "1_3_RATING_YEAR_USED (" + row["1_3_YEARS_OF_DATA"] + ")", errors);
            AssertTrue(row, row["1YR_YEARS_OF_DATA"] == expectedOneYear, "1YR_YEARS_OF_DATA (" + row["1YR_YEARS_OF_DATA"] + ")", errors);
            AssertTrue(row, row["3YR_YEARS_OF_DATA"] == expectedThreeYear, "3YR_YEARS_OF_DATA (" + row["3YR_YEARS_OF_DATA"] + ")", errors);
        }
Exemplo n.º 30
0
        public void VerifyLevelOrder()
        {
            // state which levels are less than other levels
            var pairs = new[]
                {
                    Tuple.Create(Level.Trace, Level.Debug),
                    Tuple.Create(Level.Debug, Level.Info),
                    Tuple.Create(Level.Info, Level.Warn),
                    Tuple.Create(Level.Warn, Level.Error),
                    Tuple.Create(Level.Error, Level.Fatal)
                };

            // ensure statements above are correct
            Assert.True(pairs.All(x => x.Item1 < x.Item2));

            // ensure all levels are being tested
            Assert.Equal(Enum.GetValues(typeof (Level)).Length,
                         pairs.Select(x => x.Item1).Distinct().Count() + 1);
        }