public void Put_Person_Sets_Id_Before_Update()
        {
            // Arrange
            var updatedId = ObjectId.GenerateNewId();
            var service = Mock.Of<IPersonService>();
            var controller = new PersonController(service);

            // Act
            controller.Put(updatedId.ToString(), new Web.Models.Person());

            // Assert
            Mock.Get(service).Verify(s => s.Update(It.Is<Library.Entity.Person>(p => p.Id == updatedId)), Times.Once);
        }
        public void Put_Person_Throws_When_Update_fails()
        {
            // Arrange
            var person = new Web.Models.Person {Id = ObjectId.GenerateNewId().ToString()};
            var service = new Mock<IPersonService>();
            service.Setup(s => s.Update(It.IsAny<Library.Entity.Person>())).Throws<Exception>();
            var controller = new PersonController(service.Object);

            // Act
            var result = controller.Put(person.Id, person) as ExceptionResult;

            // Assert
            Assert.NotNull(result);
        }
        public void Put_Person_Runs_Service_Update()
        {
            // Arrange
            var person = new Web.Models.Person
            {
                FirstName = "John",
                LastName = "McClung",
                MiddleName = "Paul",
                Notes = "Crazy as can be",
                Id = ObjectId.GenerateNewId().ToString()
            };
            var service = Mock.Of<IPersonService>();
            var controller = new PersonController(service);

            // Act
            controller.Put(person.Id, person);

            // Assert
            Mock.Get(service).Verify(s =>
                s.Update(It.Is<Library.Entity.Person>
                    (e => e.Id.ToString() == person.Id)), Times.Once);
        }