System.Tests.EnvironmentTests.GetLogicalDrives_Windows_MatchesExpectedLetters C# (CSharp) Method

GetLogicalDrives_Windows_MatchesExpectedLetters() private method

private GetLogicalDrives_Windows_MatchesExpectedLetters ( ) : void
return void
        public void GetLogicalDrives_Windows_MatchesExpectedLetters()
        {
            string[] drives = Environment.GetLogicalDrives();

            uint mask = (uint)GetLogicalDrives();
            var bits = new BitArray(new[] { (int)mask });

            Assert.Equal(bits.Cast<bool>().Count(b => b), drives.Length);
            for (int bit = 0, d = 0; bit < bits.Length; bit++)
            {
                if (bits[bit])
                {
                    Assert.Contains((char)('A' + bit), drives[d++]);
                }
            }
        }