示例#1
0
        public void Can_dispatch_to_custom_implementation_one_arg()
        {
            var fakeSetMock = new Mock <FakeDbSet <MigrationsCustomer> >();
            var dbSetMock   = fakeSetMock.As <IDbSet <MigrationsCustomer> >();

            var customer = new MigrationsCustomer();

            dbSetMock.Object.AddOrUpdate(new[] { customer });

            fakeSetMock.Verify(f => f.AddOrUpdate(customer), Times.AtMostOnce());
        }
示例#2
0
        public void Can_dispatch_to_custom_implementation_two_args()
        {
            var fakeSetMock = new Mock <FakeDbSet <MigrationsCustomer> >();
            var dbSetMock   = fakeSetMock.As <IDbSet <MigrationsCustomer> >();

            var customer = new MigrationsCustomer();

            Expression <Func <MigrationsCustomer, object> > identifierExpression = c => c.CustomerNumber;

            dbSetMock.Object.AddOrUpdate(identifierExpression, new[] { customer });

            fakeSetMock.Verify(f => f.AddOrUpdate(identifierExpression, customer), Times.AtMostOnce());
        }