public void ensure_method_invocations_for_Delete()
        {
            ProxyStub proxy = BuildProxy();

            proxy.Delete(1);

            proxy.OnBeforeDeleteExecutedWasInvoked.ShouldBe(true);
            proxy.OnAfterDeleteExecutedWasInvoked.ShouldBe(true);
        }
        public void ensure_method_invocations_for_Insert()
        {
            ProxyStub proxy = BuildProxy();

            proxy.Insert(new Person {
                ID = 1
            });

            proxy.OnBeforeInsertExecutedWasInvoked.ShouldBe(true);
            proxy.OnAfterInsertExecutedWasInvoked.ShouldBe(true);
        }
        public void ensure_method_invocations_for_GetAll()
        {
            var mockContext = new Mock <Context>();

            mockContext.Setup(m => m.Set <Person>()).Returns(GetMockSet());
            var proxy = new ProxyStub(mockContext.Object);

            proxy.GetAll();
            proxy.OnBeforeGetAllExecutedWasInvoked.ShouldBe(true);
            proxy.OnAfterGetAllExecutedWasInvoked.ShouldBe(true);
        }
        private ProxyStub BuildProxy()
        {
            var mockContext = new Mock <Context>();

            mockContext.Setup(m => m.Set <Person>()).Returns(GetMockSet());
            mockContext.Setup(m => m.Entry <Person>(It.IsAny <Person>()));
            //mockContext.Protected()
            //           .Setup<Person>("Entry", ItExpr.IsAny<Person>());
            var proxy = new ProxyStub(mockContext.Object);

            return(proxy);
        }
        public void ensure_method_invocations_for_Update()
        {
            var context = new Context();
            var proxy   = new ProxyStub(context);


            //ProxyStub proxy = BuildProxy();

            proxy.Update(new Person {
                ID = 1
            });

            proxy.OnBeforeUpdateExecutedWasInvoked.ShouldBe(true);
            proxy.OnAfterUpdateExecutedWasInvoked.ShouldBe(true);
        }