Пример #1
0
        public void TestDequeueWithEmptyList( )
        {
            Rhino.Mocks.MockRepository oMocks = new Rhino.Mocks.MockRepository( );

            Utility.IXmlFilePersister oXmlFilePersister = oMocks.StrictMock <Utility.IXmlFilePersister> ( );

            using (oMocks.Record( ))
            {
                Rhino.Mocks.Expect
                .Call(oXmlFilePersister.Load(""))
                .IgnoreArguments( )
                .Return(null);

                Rhino.Mocks.Expect
                .Call(() => oXmlFilePersister.Save("", null))
                .IgnoreArguments( );
            }

            using (oMocks.Playback( ))
            {
                Service.Waitlist svc = new Service.Waitlist(oXmlFilePersister);

                svc.Dequeue(new Data.Person( )
                {
                    Id = Guid.NewGuid( ), Name = Guid.NewGuid( ).ToString( ), Phone = Guid.NewGuid( ).ToString( )
                });
            }
        }
Пример #2
0
        public void TestDequeue( )
        {
            Rhino.Mocks.MockRepository oMocks = new Rhino.Mocks.MockRepository( );

            Utility.IXmlFilePersister oXmlFilePersister = oMocks.StrictMock <Utility.IXmlFilePersister> ( );

            using (oMocks.Record( ))
            {
                Rhino.Mocks.Expect
                .Call(oXmlFilePersister.Load(""))
                .IgnoreArguments( )
                .Return(System.Xml.Linq.XElement.Parse("<Waitlist><Persons><Person Id=\"47a73298-d91c-4c94-80aa-d935c9b0873e\"><Name>50ffab1f-b894-4632-898d-2c6588856641</Name><Phone>5be558b7-2c57-4156-96e0-d2442bc41975</Phone></Person></Persons></Waitlist>"));

                Rhino.Mocks.Expect
                .Call(() => oXmlFilePersister.Save("", null))
                .IgnoreArguments( );
            }

            using (oMocks.Playback( ))
            {
                Service.Waitlist svc = new Service.Waitlist(oXmlFilePersister);

                svc.Dequeue(new Data.Person( )
                {
                    Id = new Guid("47a73298-d91c-4c94-80aa-d935c9b0873e"), Name = "50ffab1f-b894-4632-898d-2c6588856641", Phone = "5be558b7-2c57-4156-96e0-d2442bc41975"
                });
            }
        }