Exemple #1
0
        private void CallbackMatcherTest5(Mock <IParentInterface> mock)
        {
            var c = new CallbackMatcher <Action>();
            var v = new Version(1, 2, 3, 4);

            mock.Expects.AtLeastOne.SetProperty(_ => _.ReadWriteObjectProperty).To(Is.TypeOf <Version>());

            using (Factory.Ordered())
            {
                mock.Expects.AtLeastOne.SetProperty(_ => _[4, 5]).To(Is.TypeOf <DateTime>());
                mock.Expects.One.Method(_ => _.AsyncMethod((Action)null)).With(c);
            }

            var p = new TestPresenter(mock.MockObject);

            p.SetPropertyOfMockToInternalValue();
            p.SetPropertyOfMockToInternalValue();
            p.SetIndexerPropertyOfMockToInternalValue();
            p.SetIndexerPropertyOfMockToInternalValue();
            p.BeginInvoke();

            c.Callback();

            Assert.AreEqual(TestPresenter.END_INVOKE, p.Status);
        }
Exemple #2
0
        private void GetPropertyPreviousSetter2Test(Mock <IParentInterface> mock)
        {
            var expectations = new Expectations(2);

            expectations[0] = mock.Arrange(_ => _.ReadWriteObjectProperty).To(Is.TypeOf <Version>());
            expectations[1] = mock.Arrange(_ => _.ReadWriteObjectProperty).WillReturnSetterValue();

            var presenter = new TestPresenter(mock.MockObject);

            presenter.SetPropertyOfMockToInternalValue();

            Assert.AreEqual(5, mock.MockObject.ReadWriteObjectProperty.Major);

            expectations.ForEach(_ => _.Assert());
        }
Exemple #3
0
        public void FakeTest1()
        {
            //arrange
            var fake      = new Fake <IParentInterface>();
            var presenter = new TestPresenter(fake.MockObject);

            //act
            presenter.SetPropertyOfMockToInternalValue();
            presenter.SetIndexerPropertyOfMockToInternalValue();
            presenter.BeginInvoke();
            presenter.HookUpStandardEvent1();

            //assert
            fake.PropertyIs(_ => _.ReadWriteObjectProperty = new Version(5, 6, 7, 8));
            fake.Property(_ => _.ReadWriteObjectProperty).Is(new Version(5, 6, 7, 8));
        }