public void SetUp()
        {
            _contact = new Contact() { FirstName = "David", Surname = "Miranda", Telephone = "666" };
            _dataReader = new Mock<IDatabaseReader>();
            _dataReader.Setup(x => x.Read()).Returns(true);
            _dataReader.Setup(x => x.Get<string>("FirstName")).Returns("David");
            _dataReader.Setup(x => x.Get<string>("Surname")).Returns("Miranda");
            _dataReader.Setup(x => x.Get<string>("Telephone")).Returns("666");

            _databaseSession = new Mock<IDatabaseSession>();
            _databaseSession.Setup(x => x.CreateQuery()).Returns(new DataQuery());

            _databaseSessionFactory = new Mock<IDatabaseSessionFactory>();
            _databaseSessionFactory.Setup(x => x.CreateSession(It.IsAny<string>())).Returns(_databaseSession.Object);

            _contactRepository = new ContactRepository(_databaseSessionFactory.Object);
        }
        public void ShouldGetNameAndDirectionOfParameter()
        {
            //Given
            var databaseSessionStub = new DatabaseSessionStub {UpdateResultParameter = new SqlParameter {Value = 12}};
            var databaseSessionFactoryStub = new DatabaseSessionFactoryStub {SessionValue = databaseSessionStub};

            //When
            var contact = new Contact
            {
                FirstName = "David",
                Surname = "Miranda",
                Telephone = "666"
            };
            var contactId = new ContactRepository(databaseSessionFactoryStub).UpdateContact(contact);
            var dbQueries = databaseSessionStub.Queries;

            //Then
            Assert.That(dbQueries[0].Parameters[0].Direction, Is.EqualTo(ParameterDirection.Output));
            Assert.That(dbQueries[0].Parameters[0].Name, Is.EqualTo("@ContactId"));
            Assert.That(dbQueries[0].StoredProcName, Is.EqualTo("proc_name"));
            Assert.That(dbQueries[0].Parameters[1].Value, Is.EqualTo(contact.FirstName));
            Assert.That(dbQueries[0].Parameters[2].Value, Is.EqualTo(contact.Surname));
            Assert.That(dbQueries[0].Parameters[3].Value, Is.EqualTo(contact.Telephone));
            Assert.That(contactId, Is.EqualTo(12));
        }