Ejemplo n.º 1
0
        public void Call_BubbleEvent_WrongArgumentType_Exception()
        {
            var subject = new ControlSpy();

            Assert.That(() => ControlLifecycle.Call(subject, "OnBubbleEvent", 1, "notEventArgs"),
                        Throws.ArgumentException);
        }
Ejemplo n.º 2
0
        public void Fake_Load_MoreArguments_Exception()
        {
            var subject = new ControlSpy();

            Assert.That(() => ControlLifecycle.Fake(subject, s => s.Load += null, "notEventArgs", 1),
                        Throws.InstanceOf<TargetParameterCountException>());
        }
Ejemplo n.º 3
0
        public void Call_BubbleEvent_MoreArguments_Exception()
        {
            var subject = new ControlSpy();

            Assert.That(() => ControlLifecycle.Call(subject, "OnBubbleEvent", 1, EventArgs.Empty, TimeSpan.Zero),
                        Throws.InstanceOf<TargetParameterCountException>());
        }
Ejemplo n.º 4
0
        public void Call_BubbleEvent_LessArguments_Exception()
        {
            var subject = new ControlSpy();

            Assert.That(() => ControlLifecycle.Call(subject, "OnBubbleEvent", "anObject"),
                        Throws.InstanceOf<TargetParameterCountException>());
        }
Ejemplo n.º 5
0
        public void Fake_Load_CustomArguments_StepCalledWithCustomArguments()
        {
            var subject = new ControlSpy();
            EventArgs custom = new EventArgs();
            ControlLifecycle.Fake(subject, s => s.Load += null, custom);

            Assert.That(subject.LastStep.StepName, Is.EqualTo("OnLoad"));
            Assert.That(subject.LastStep.StepArguments[0], Is.SameAs(custom));
        }
Ejemplo n.º 6
0
        public void Call_BubbleEvent_NoArguments_StepCalledWithNull()
        {
            var subject = new ControlSpy();

            ControlLifecycle.Call(subject, "OnBubbleEvent");

            Assert.That(subject.LastStep.StepName, Is.EqualTo("OnBubbleEvent"));
            Assert.That(subject.LastStep.StepArguments, Is.EqualTo(new object[] {null, null}));
        }
Ejemplo n.º 7
0
        public void Call_BubbleEvent_CustomArguments_StepCalledWithCustomArguments()
        {
            object sender = new object();
            EventArgs args = new EventArgs();

            var subject = new ControlSpy();
            ControlLifecycle.Call(subject, "OnBubbleEvent", sender, args);

            Assert.That(subject.LastStep.StepName, Is.EqualTo("OnBubbleEvent"));
            Assert.That(subject.LastStep.StepArguments[0], Is.SameAs(sender));
            Assert.That(subject.LastStep.StepArguments[1], Is.SameAs(args));
        }
Ejemplo n.º 8
0
        public void Fake_Load_WrongArgumentType_Exception()
        {
            var subject = new ControlSpy();

            Assert.That(() => ControlLifecycle.Fake(subject, s => s.Load += null, "notEventArgs"),
                        Throws.ArgumentException);
        }
Ejemplo n.º 9
0
        public void Fake_Load_NoArguments_StepCalledWithNull()
        {
            var subject = new ControlSpy();

            ControlLifecycle.Fake(subject, s => s.Load += null);

            Assert.That(subject.LastStep.StepName, Is.EqualTo("OnLoad"));
            Assert.That(subject.LastStep.StepArguments, Is.EqualTo(new object[] {null}));
        }