public void Constructor_WithEmptyDetails_ThrowException()
 {
     sut = new ProgressController(null);
 }
        public void Setup()
        {
            user = new Mock<IPrincipal>();
            identity = new Mock<IIdentity>();
            user.Setup(x => x.Identity).Returns(identity.Object);
            identity.Setup(x => x.Name).Returns("Tom");
            Thread.CurrentPrincipal = user.Object;

            uowMock = new Mock<IReadgressUow>();
            progressRepositoryMock = new Mock<IProgressRepository>();

            HttpConfiguration config = new HttpConfiguration();
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/api/progress");
            IHttpRoute route = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}");
            HttpRouteData routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "progress" } });

            sut = new ProgressController(uowMock.Object);
            sut.ControllerContext = new HttpControllerContext(config, routeData, request);
            sut.Request = request;
            sut.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
            sut.Request.Properties.Add(HttpPropertyKeys.HttpRouteDataKey, routeData);

            readerTest = new Reader
            {
                Id = 1,
                FirstName = "Tom",
                LastName = "Jerry",
                Email = "*****@*****.**",
                Gender = "Male",
                UserName = "******",
                Link = "www.jerry.com",
                CreatedOn = DateTime.Now
            };

            progressesTest = new List<Progress>()
            {
                new Progress()
                {
                    Id=1, Isbn="OL12345", ReaderId=1, Reader=readerTest, IsFinished=false
                },
                new Progress()
                {
                    Id=2, Isbn="OL56789", ReaderId=1, Reader=readerTest, IsFinished=false
                }
            };
        }