public void TestPieChartCompareWindow()
        {
            frmMain main = new frmMain();
            ChartSingleCompareOrig chart = main.LaunchChart(712, "splitdisplay", false);

            WinFormsApprovals.Verify(chart);
        }
        public void TestBarChartWindow()
        {
            frmMain main = new frmMain();
            ChartSingleCompareOrig chart = main.LaunchChart(150, "rpfll", false);

            WinFormsApprovals.Verify(chart);
        }
예제 #3
0
        public void TestBarChartCompare()
        {
            frmMain main = new frmMain();
            ChartSingleCompareOrig chart = main.LaunchChart(406, "splitdisplay", false);

            chart.Show();
            WinFormsApprovals.Verify(chart);
        }
예제 #4
0
        public void TestPieChartCompareWindow()
        {
            frmMain main = new frmMain();
            ChartSingleCompareOrig chart = main.LaunchChart(712, "splitdisplay", false);

            chart.Show();
            ApprovalTests.WinForms.Approvals.Approve(chart);
        }
예제 #5
0
        public void TestBarChartWindow()
        {
            frmMain main = new frmMain();
            ChartSingleCompareOrig chart = main.LaunchChart(150, "rpfll", false);

            chart.Show();
            ApprovalTests.WinForms.Approvals.Approve(chart);
        }
예제 #6
0
        public void TestBarChartWindow()
        {
            frmMain main = new frmMain();

            main.Show();
            ChartSingleCompareOrig chart = main.LaunchChart(150, "rpfll", false);

            chart.Show();

            byte[] generatedImgData;
            string approvedImgString;


            using (var generatedBitmap = new Bitmap(chart.Width, chart.Height))
            {
                chart.DrawToBitmap(generatedBitmap, new Rectangle(0, 0, chart.Width, chart.Height));
                using (var generatedBitmapStream = new MemoryStream())
                {
                    generatedBitmap.Save(generatedBitmapStream, ImageFormat.Png);
                    generatedImgData = generatedBitmapStream.GetBuffer();
                }
            }
            chart.Close();
            chart.Dispose();
            main.Close();
            main.Dispose();

            var assembly = Assembly.GetExecutingAssembly();

            using (
                var approvedStream =
                    assembly.GetManifestResourceStream("ChartSmart.Test.ChartSmartTest.TestBarChartWindow.approved.txt")
                )
            {
                using (var reader = new StreamReader(approvedStream))
                {
                    approvedImgString = reader.ReadToEnd();
                }
            }

            var generatedImgStringSb = new StringBuilder();

            foreach (var imgByte in generatedImgData)
            {
                generatedImgStringSb.Append(imgByte + ",");
            }
            var generatedImgString = generatedImgStringSb.ToString();

            //File.WriteAllText(@"C:\Projects\DesignPatternsAndSoftwareCraftmanship\DesignPrinciples\Refactoring\After\ChartSmart.Test\ChartSmartTest.TestBarChartWindow.txt", generatedImgString);

            Assert.IsTrue(approvedImgString == generatedImgString);
        }