Example #1
0
        private static void ClearStrictCollectionAndDisposesItCommon(CollectionBase collection)
        {
            collection.Expect(x => x.Clear());

            IDisposable disposable = (IDisposable)collection;

            disposable.Expect(x => x.Dispose());

            CleanCollection(collection);

            collection.VerifyAllExpectations();
            //disposable.VerifyAllExpectations();
        }
Example #2
0
        private static void CanCreateAStrictMultiMockFromTwoInterfacesCommon(IDemo demo)
        {
            demo.Expect(x => x.ReturnIntNoArgs()).Return(1);
            IDisposable disposable = demo as IDisposable;

            Assert.NotNull(disposable);
            disposable.Expect(x => x.Dispose());

            Assert.Equal(1, demo.ReturnIntNoArgs());
            disposable.Dispose();

            demo.VerifyAllExpectations();
        }