コード例 #1
0
 public void EnumerableDoesNotMatchApproval()
 {
     Approvals.Approve(new[]
     {
         "Does not match"
     }, "collection");
 }
コード例 #2
0
 public void EnumerableNotApprovedYet()
 {
     Approvals.Approve(new[]
     {
         "Not approved"
     }, "collection");
 }
コード例 #3
0
        public virtual void ApproveRssFeedItemExplicitCountParse()
        {
            var feed         = Factory.CreateFeed(feeduri);
            var strFeedItems = from feeditem in feed.Items.Take(itemCount)
                               select feeditem.ToApprovalString();

            Approvals.Approve(strFeedItems, "feed items");
        }
コード例 #4
0
        public virtual void ApproveAtomFeedItemParse()
        {
            IFeed feed         = Factory.CreateFeed(feeduri);
            var   strFeedItems = from feeditem in feed.Items
                                 select feeditem.ToApprovalString();

            Approvals.Approve(strFeedItems, "feed items");
        }
コード例 #5
0
        public void Approve(string path, string testName, byte[] content)
        {
            IApprovalNamer           namer    = new SimpleNamer(path, testName);
            IApprovalWriter          writer   = new BinaryWriter(content, "png");
            IApprovalFailureReporter reporter = new ImageReporter();

            Approvals.Approve(writer, namer, reporter);
        }
コード例 #6
0
        public virtual void ApproveRssFeedItemContent()
        {
            var feed         = Factory.CreateFeed(feeduri);
            var strFeedItems = from feeditem in feed.Items
                               select feeditem.ToApprovalString();

            Approvals.Approve(strFeedItems, "feed items");
        }
コード例 #7
0
        public void TestExistFileIsApproved()
        {
            var basePath = Environment.CurrentDirectory + @"\..\..\";

            var original = basePath + "a.png";
            var copy     = basePath + "a1.png";

            File.Copy(original, copy);
            Approvals.Approve(new ExistingFileWriter(copy), Approvals.GetDefaultNamer(), Approvals.GetReporter());
        }
コード例 #8
0
        public void WatchForResultsShouldConfigureWatcher()
        {
            var serviceSentry = Monitor.Interactions(typeof(Service));

            Service service = new Service();

            service.WatchForResults("", () => { });

            Approvals.Approve(serviceSentry.Report);
        }
コード例 #9
0
 public void TestReporter()
 {
     try
     {
         Approvals.Approve("Hello");
     }
     catch (AssertionException e)
     {
         Assert.AreEqual("  String lengths are both 5. Strings differ at index 0.\r\n  Expected: \"World\"\r\n  But was:  \"Hello\"\r\n  -----------^\r\n", e.Message);
     }
 }
コード例 #10
0
        public void StartTheExplorerWhenInitializingThePlugin()
        {
            Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn));

            Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn("");
            Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(true);
            Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true);
            PlugIn plugin = new PlugIn();

            Approvals.Approve(pluginSentry.Report);
        }
コード例 #11
0
 public void TestReporter()
 {
     try
     {
         Approvals.Approve("Hello");
     }
     catch (AssertFailedException e)
     {
         Assert.AreEqual("Assert.AreEqual failed. Expected:<World>. Actual:<Hello>. ", e.Message);
     }
 }
コード例 #12
0
        public void HideOverlayWhenTextHasChanged()
        {
            Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn));

            Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(false);

            PlugIn plugin = new PlugIn();

            plugin.WhenTextChanges(null);

            Approvals.Approve(pluginSentry.Report);
        }
コード例 #13
0
        public void DisplayOverlayOnShow()
        {
            overlay.Show(new List <CoverageResult> {
                new CoverageResult {
                    VisitCount = 0
                }, new CoverageResult {
                    VisitCount = 1
                }
            });

            Approvals.Approve(visualStudioSentry.Report);
        }
コード例 #14
0
        public void TestTimes()
        {
            var log = Logger.LogToStringBuilder();

            Logger.UseTimer(new MockTimer());
            Logger.Show(timestamp: true, timeDifference: true);
            Logger.Variable("name", "Llewellyn");
            Logger.Variable("name", "Llewellyn");
            Logger.Variable("name", "Llewellyn");

            Approvals.Approve(log.ToString());
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: igoreksiz/OldUnit
        static void Main(string[] args)
        {
            var v = "valuie";
            var x = "xalue;";

            Console.WriteLine("Starting");
            Approvals.DefaultNamerSource    = (() => new OldUnitNamer(v, x));
            Approvals.DefaultReporterSource = (() => new ApprovalTests.Reporters.DiffReporter());
            x = @"c:\testnamer";
            Approvals.Approve("TEST");

            Console.ReadLine();
        }
コード例 #16
0
        public void CacheResults()
        {
            var serviceSentry = Monitor.Interactions(typeof(Service));

            Isolate.WhenCalled(() => VisualStudio.ActiveFilePath).WillReturn("foo.cs");

            Service service = new Service();

            service.GetCoverageResultsForActiveDocument();
            service.GetCoverageResultsForActiveDocument();

            Approvals.Approve(serviceSentry.Report);
        }
コード例 #17
0
        public void UpdateOverlayWhenPaintingBackground()
        {
            Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn));

            Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn("");
            Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(true);
            Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true);
            PlugIn plugin = new PlugIn();

            plugin.WhenPaintingBackground(null);

            Approvals.Approve(pluginSentry.Report);
        }
コード例 #18
0
ファイル: Tests.cs プロジェクト: stocksr/ApprovalTests.Net
        public void TestMethod1()
        {
            var control = new TestSilverlightControl();

            TestHelper.WaitFor(this, control, "Loaded");
            TestPanel.Children.Add(control);

            EnqueueCallback(() => Approvals.Approve(
                                @"D:\Projects\ApprovalTests\ApprovalTests.Silverlight.Tests",
                                "Tests.TestMethod1",
                                control));

            EnqueueTestComplete();
        }
コード例 #19
0
        public void StartTheServiceWhenASolutionIsOpen()
        {
            Sentry pluginSentry = Monitor.Interactions(typeof(PlugIn));

            Isolate.WhenCalled(() => VisualStudio.HasASolutionOpened).WillReturn(false);
            Isolate.WhenCalled(() => VisualStudio.HasAnActiveTextView).WillReturn(true);
            Isolate.WhenCalled(() => VisualStudio.Solution).WillReturn("");

            PlugIn plugin = new PlugIn();

            plugin.AfterOpeningSolution();

            Approvals.Approve(pluginSentry.Report);
        }
コード例 #20
0
        private static void AssertLauncher(string approved, string received, DiffReporter reporter)
        {
            var args = reporter.GetLaunchArguments(approved, received);

            try
            {
                Approvals.Approve(args.ToString());
            }
            catch
            {
                reporter.Launch(args);
                throw;
            }
        }
コード例 #21
0
        public void TestDataSourceNames()
        {
            var message = "";

            try
            {
                RdlcReports.Approvals.ApproveReport(ReportName, GetAssembly(), "purposelyMisspelt", GetDefaultData());
            }
            catch (Exception e)
            {
                message = e.Message;
            }
            Approvals.Approve(message);
        }
コード例 #22
0
        public void TestMainPath()
        {
            var log = Logger.LogToStringBuilder();

            Logger.MarkerIn();
            Logger.Event("Starting");
            var name = "Llewellyn";

            Logger.Variable("name", name);
            Logger.Message("I Got here");
            Logger.Sql("Select * From table_name");
            try
            {
                throw new Exception(" Problem");
            }
            catch (Exception e)
            {
                Logger.Warning(e);
            }
            Logger.MarkerOut();
            Approvals.Approve(log.ScrubPath(PathUtilities.GetDirectoryForCaller()));
        }
コード例 #23
0
 public void TextNotApprovedYet()
 {
     Approvals.Approve("should fail with a missing exception");
 }
コード例 #24
0
 public void TextDoesNotMatchApproval()
 {
     Approvals.Approve("should fail with mismatch");
 }
コード例 #25
0
 public void MSTestVS2010()
 {
     Approvals.Approve("2010");
 }
コード例 #26
0
        public void TestInsultLoader()
        {
            string conn = @"server=.\sqlexpress;database=Insults;trusted_connection=true";

            Approvals.Approve(new InsultLoaderShortAndSweet(7, 5, conn));
        }
コード例 #27
0
 public void ParseNCover3()
 {
     Approvals.Approve(ResultParser.Parse("NCover-3.xml", @"c:\foo-3.cs"), CoverageResultsFormatter);
 }
コード例 #28
0
 public void Text()
 {
     Approvals.Approve(new CompanyLoaderByName("M"));
 }
コード例 #29
0
 public void MissingResultFile()
 {
     Approvals.Approve(ResultParser.Parse("Missing.xml", @"c:\foo.cs"), CoverageResultsFormatter);
 }
コード例 #30
0
 public void TestWeather()
 {
     Approvals.Approve(new WeatherLoader("KCASANDI69"));
 }