Esempio n. 1
0
        public void Custom_matcher_with_render_expression_renders_nicely_when_using_delegate_based_setup_expression()
        {
            var mock = new Mock <IOrderRepository>();

            var ex = Record.Exception(
                () => mock.VerifySet(repo => repo.OrderSavedLast = Order.IsBig())
                );

            Assert.Contains("repo => repo.OrderSavedLast = Order.IsBig()", ex.Message);
        }
Esempio n. 2
0
        public void ShouldExtendMatching()
        {
            var mock = new Mock <IOrderRepository>();

            mock.Setup(repo => repo.Save(Order.IsBig())).Throws(new InvalidOperationException());

            try
            {
                mock.Object.Save(new Order {
                    Amount = 1000
                });

                Assert.True(false, "Should have failed for big order");
            }
            catch (InvalidOperationException) { }
        }
Esempio n. 3
0
 public static Order IsBig()
 {
     return(Match.Create <Order>(o => o.Amount >= 1000, () => Order.IsBig()));
 }