示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainForm"/> class.
 /// </summary>
 public MainForm()
 {
     InitializeComponent();
     var presenter = new JesterPresenter(this);
     presenter.TestComplete += presenter_TestComplete;
     presenter.MutationComplete += presenter_MutationComplete;
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();
            var presenter = new JesterPresenter(this);

            presenter.TestComplete     += presenter_TestComplete;
            presenter.MutationComplete += presenter_MutationComplete;
        }
示例#3
0
        private static void Main(string[] args)
        {
            var consoleView = new JesterConsoleView();
            var presenter = new JesterPresenter(consoleView);
            presenter.MutationComplete += OnPresenterMutationComplete;
            presenter.TestComplete += OnPresenterTestComplete;

            consoleView.RunMutation(args[0], args[1]);
        }
示例#4
0
        private static void Main(string[] args)
        {
            var consoleView = new JesterConsoleView();
            var presenter   = new JesterPresenter(consoleView);

            presenter.MutationComplete += OnPresenterMutationComplete;
            presenter.TestComplete     += OnPresenterTestComplete;

            consoleView.RunMutation(args[0], args[1]);
        }
示例#5
0
        public void Can_mutate_and_test_a_target_assembly()
        {
            string targetAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.dll");
            string testAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.Tests.dll");

            UnpackSupportingTestFrameworkFiles();

            MockRepository            repository = new MockRepository();
            IJesterView               view       = repository.DynamicMock <IJesterView>();
            IEventRaiser              runEvent;
            IEnumerable <MutationDto> mutationResults = null;

            using (repository.Record())
            {
                view.Run += null;
                runEvent  = LastCall.IgnoreArguments().GetEventRaiser();
            }
            using (repository.Playback())
            {
                JesterPresenter presenter = new JesterPresenter(view);
                presenter.MutationComplete +=
                    delegate(object sender, MutationCompleteEventArgs e) { mutationResults = e.MutationResults; };

                runEvent.Raise(presenter, new RunEventArgs(targetAssembly, testAssembly, GetMutations(targetAssembly)));
            }

            int numberOfFailingTests = 0;

            foreach (MutationDto mutationDto in mutationResults)
            {
                foreach (TestResultDto testResult in mutationDto.TestResults)
                {
                    if (testResult is KilledMutantTestResultDto)
                    {
                        numberOfFailingTests++;
                    }
                }
            }

            Assert.AreEqual(3, numberOfFailingTests,
                            "After the inversion, two of the tests should fail.");
        }
        public void Can_mutate_and_test_a_target_assembly()
        {
            string targetAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.dll");
            string testAssembly =
                Utility.UnpackManifestResourceStream(
                    "JesterDotNet.Presenter.Tests.SampleData.AnimalFarm.Tests.dll");
            UnpackSupportingTestFrameworkFiles();

            MockRepository repository = new MockRepository();
            IJesterView view = repository.DynamicMock<IJesterView>();
            IEventRaiser runEvent;
            IEnumerable<MutationDto> mutationResults = null;
            using (repository.Record())
            {
                view.Run += null;
                runEvent = LastCall.IgnoreArguments().GetEventRaiser();
            }
            using (repository.Playback())
            {
                JesterPresenter presenter = new JesterPresenter(view);
                presenter.MutationComplete +=
                    delegate(object sender, MutationCompleteEventArgs e) { mutationResults = e.MutationResults; };

                runEvent.Raise(presenter, new RunEventArgs(targetAssembly, testAssembly, GetMutations(targetAssembly)));
            }

            int numberOfFailingTests = 0;
            foreach (MutationDto mutationDto in mutationResults)
                foreach (TestResultDto testResult in mutationDto.TestResults)
                    if (testResult is KilledMutantTestResultDto)
                        numberOfFailingTests++;

            Assert.AreEqual(3, numberOfFailingTests,
                "After the inversion, two of the tests should fail.");
        }