コード例 #1
0
        public void SolutionBindingOperation_GetRuleSetInformation()
        {
            // Arrange
            SolutionBindingOperation testSubject = this.CreateTestSubject();

            // Test case 1: unknown ruleset map
            var ruleSetMap = new Dictionary <Language, IBindingConfig>();

            testSubject.RegisterKnownConfigFiles(ruleSetMap);

            // Act + Assert
            using (new AssertIgnoreScope())
            {
                testSubject.GetBindingConfig(Language.CSharp).Should().BeNull();
            }

            // Test case 2: known ruleset map
            // Arrange
            ruleSetMap[Language.CSharp] = CreateMockConfigFile("c:\\csharp.txt").Object;
            ruleSetMap[Language.VBNET]  = CreateMockConfigFile("c:\\vb.txt").Object;

            testSubject.RegisterKnownConfigFiles(ruleSetMap);
            testSubject.Initialize(new ProjectMock[0]);
            testSubject.Prepare(CancellationToken.None);

            // Act
            var config = testSubject.GetBindingConfig(Language.CSharp);

            // Assert
            config.Should().Be(testSubject.RuleSetsInformationMap[Language.CSharp]);
        }