Ejemplo n.º 1
0
        public void SubmitDataToDB()
        {
            //Setup a mock view and ISumbition
            MockRepository mocks           = new MockRepository();
            IView          myMockView      = (IView)mocks.DynamicMock(typeof(IView));
            ISumbition     myMockSubmition = (ISumbition)mocks.DynamicMock(typeof(ISumbition));

            //Record expectations
            SetupResult.For(myMockView.UserID).Return(3105596L);
            SetupResult.For(myMockView.Name).Return("Someone");
            SetupResult.For(myMockView.Address).Return("Somewhere");

            using (mocks.Ordered())
            {
                using (mocks.Unordered())
                {
                    myMockSubmition.Name    = "Someone";
                    myMockSubmition.Address = "Somewhere";
                    myMockSubmition.UserID  = 3105596L;
                }
                myMockSubmition.Save();
            }

            //setup the present
            mocks.ReplayAll();

            Presneter myPresenter = new Presneter(myMockView, myMockSubmition);

            myPresenter.Sumbit();

            mocks.VerifyAll();
        }
Ejemplo n.º 2
0
            public void Sumbit()
            {
                submition.Address = view.Address;
                submition.Name    = view.Name;
                submition.UserID  = view.UserID;

                submition.Save();
            }