コード例 #1
0
        public void CanCreateADynamicMultiMockFromTwoInterfacesGenericAndAssertWasCalled()
        {
            IDemo           demo     = MockRepository.GenerateMock <IDemo, IEditableObject>();
            IEditableObject editable = demo as IEditableObject;

            demo.ReturnIntNoArgs();
            editable.BeginEdit();
            editable.CancelEdit(); // we don't care about this
            editable.EndEdit();

            demo.AssertWasCalled(x => x.ReturnIntNoArgs());
            editable.AssertWasCalled(x => x.BeginEdit());
            editable.AssertWasCalled(x => x.EndEdit());

            // Double check all expectations were verified
            editable.VerifyAllExpectations();
        }