示例#1
0
            public void Spec10()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 2);
                    testable.SetupJSLintFile("file2.js", 0);
                    testable.SetupJSLintFile("file3.js", 3);

                    testable.Instance.Execute();

                    I.Expect(testable.Instance.ErrorFileCount).ToBe(2);
                }
            }
示例#2
0
            public void Spec14()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 3);
                    testable.SetupJSLintFile("file2.js", 5);

                    testable.Instance.Execute();

                    testable.JSLintReportBuilderMock.Verify(x => x.AddFile(It.Is <string>(y => y.EndsWith("file1.js")), It.IsAny <IJSLintData>()));
                    testable.JSLintReportBuilderMock.Verify(x => x.AddFile(It.Is <string>(y => y.EndsWith("file2.js")), It.IsAny <IJSLintData>()));
                }
            }
示例#3
0
            public void Spec04()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 5);
                    testable.SetupJSLintFile("file2.js", 0);
                    testable.SetupJSLintFile("file3.js", 3);

                    var actual = testable.Instance.Execute();

                    I.Expect(actual).ToBeFalse();
                }
            }
示例#4
0
            public void Spec09()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 2);
                    testable.SetupJSLintFile("file2.js", 1);
                    testable.SetupJSLintFile("file3.js", 5);
                    testable.SetupJSLintFile("file4.js", 2);

                    testable.Instance.Execute();

                    I.Expect(testable.Instance.ErrorCount).ToBe(10);
                }
            }
示例#5
0
            public void Spec11()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 3);
                    testable.SetupJSLintFile("file2.js", 0);
                    testable.SetupJSLintFile("file3.js", 0);
                    testable.SetupJSLintFile("file4.js", 1);

                    testable.Instance.Execute();

                    I.Expect(testable.Instance.ProcessedFileCount).ToBe(4);
                }
            }
示例#6
0
            public void Spec06()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 0);
                    testable.SetupJSLintFile("jsfile2.js", 0);

                    testable.Instance.Execute();

                    testable.JSLintContextMock.Verify(x => x.Lint("file1.js contents", It.IsAny <JSLintOptions>()));
                    testable.JSLintContextMock.Verify(x => x.Lint("jsfile2.js contents", It.IsAny <JSLintOptions>()));
                    testable.JSLintContextMock.Verify(x => x.Lint(It.IsAny <string>(), It.IsAny <JSLintOptions>()), Times.Exactly(2));
                }
            }
示例#7
0
            public void Spec07()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file1.js", 2);
                    testable.SetupJSLintFile("jsfile2.js", 1);

                    testable.Instance.Execute();

                    testable.LoggingHelperMock.Verify(x => x.LogError(It.IsAny <string>(), null, null, It.Is <string>(y => y.EndsWith("file1.js")), 1, 1, 0, 0, "JSLint : file1.js message 1"));
                    testable.LoggingHelperMock.Verify(x => x.LogError(It.IsAny <string>(), null, null, It.Is <string>(y => y.EndsWith("file1.js")), 2, 2, 0, 0, "JSLint : file1.js message 2"));
                    testable.LoggingHelperMock.Verify(x => x.LogError(It.IsAny <string>(), null, null, It.Is <string>(y => y.EndsWith("jsfile2.js")), 1, 1, 0, 0, "JSLint : jsfile2.js message 1"));
                    testable.LoggingHelperMock.Verify(x => x.LogWarning(It.IsAny <string>(), null, null, It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), 0, 0, It.IsAny <string>()), Times.Never());
                }
            }
示例#8
0
            public void Spec16()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", JSLintNetSettings.DefaultErrorLimit);

                    testable.Instance.Execute();

                    I.Expect(testable.BuildEngine.ErrorEvents).ToContain(x => x.Message == string.Format(Resources.ErrorLimitReachedFormat, JSLintNetSettings.DefaultErrorLimit));
                }
            }
示例#9
0
            public void Spec13()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 0);

                    testable.Instance.Execute();

                    testable.Verify <IJSLintFactory>(x => x.CreateReportBuilder());
                }
            }
示例#10
0
            public void Spec02()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 0);

                    var actual = testable.Instance.Execute();

                    I.Expect(actual).ToBeTrue();
                }
            }
示例#11
0
            public void Spec18()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 0);
                    testable.ProcessedFileCount = JSLintNetSettings.DefaultFileLimit;

                    testable.Instance.Execute();

                    testable.LoggingHelperMock.Verify(x => x.LogError(Resources.FileLimitReachedFormat, JSLintNetSettings.DefaultFileLimit));
                }
            }
示例#12
0
            public void Spec15()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 0);

                    testable.Instance.ReportFile = "REPORTFILE";
                    testable.Instance.Execute();

                    testable.Verify <IFileSystemWrapper>(x => x.WriteAllText(@"D:\solution\source\project\REPORTFILE", It.IsAny <string>(), Encoding.UTF8));
                }
            }
示例#13
0
            public void Spec05()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 2);
                    testable.Settings.Output = Output.Warning;
                    testable.SettingsExist   = true;

                    var actual = testable.Instance.Execute();

                    I.Expect(actual).ToBeTrue();
                }
            }
示例#14
0
            public void Spec19()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.Settings.ErrorLimit = 10;
                    testable.SettingsExist       = true;
                    testable.SetupJSLintFile("file.js", 11);

                    testable.Instance.Execute();

                    testable.LoggingHelperMock.Verify(x => x.LogError(Resources.ErrorLimitReachedFormat, 11));
                }
            }
示例#15
0
            public void Spec15()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.SetupJSLintFile("file.js", 0);

                    testable.Instance.ReportFile = "REPORTFILE";
                    testable.Instance.Execute();

                    testable.JSLintReportBuilderMock.Verify(x => x.ToString());
                    testable.Verify <IFileSystemWrapper>(x => x.WriteAllText(@"D:\solution\source\project\REPORTFILE", "REPORTRESULT", Encoding.UTF8));
                }
            }
示例#16
0
            public void Spec19()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.Settings.ErrorLimit = 10;
                    testable.SettingsExist       = true;
                    testable.SetupJSLintFile("file.js", 11);

                    testable.Instance.Execute();

                    I.Expect(testable.BuildEngine.ErrorEvents).ToContain(x => x.Message == string.Format(Resources.ErrorLimitReachedFormat, 11));
                }
            }
示例#17
0
            public void Spec18()
            {
                using (var testable = new ExecuteTestable())
                {
                    for (int i = 0; i < JSLintNetSettings.DefaultFileLimit; i++)
                    {
                        testable.SetupJSLintFile("file" + i + ".js", 0);
                    }

                    testable.Instance.Execute();

                    I.Expect(testable.BuildEngine.ErrorEvents).ToContain(x => x.Message == string.Format(Resources.FileLimitReachedFormat, JSLintNetSettings.DefaultFileLimit));
                }
            }
示例#18
0
            public void Spec20()
            {
                using (var testable = new ExecuteTestable())
                {
                    testable.Settings.FileLimit = 10;
                    testable.SettingsExist      = true;

                    for (int i = 0; i < 10; i++)
                    {
                        testable.SetupJSLintFile("file" + i + ".js", 0);
                    }

                    testable.Instance.Execute();

                    I.Expect(testable.BuildEngine.ErrorEvents).ToContain(x => x.Message == string.Format(Resources.FileLimitReachedFormat, 10));
                }
            }