public void PostStudent_WithSchoolId_ShouldReturnStatusCode201()
        {
            var mockRepository = Mock.Create <IStudentRepository <Student> >();

            Mock.Arrange(() => mockRepository
                         .Add(Arg.Matches <Student>(student =>
                                                    student.FirstName == "Joshua" &&
                                                    student.LastName == "Tomson" &&
                                                    student.Age == 15 &&
                                                    student.Grade == 9),
                              Arg.Matches <int>(x => x == 1)))
            .Returns(() => new Student()
            {
                FirstName = "Joshua",
                LastName  = "Tomson",
                Age       = 15,
                Grade     = 9
            });

            var server =
                new InMemoryHttpServer <Student>("http://localhost/", mockRepository);

            var response = server.CreatePostRequest("api/students?schoolId=1",
                                                    new Student()
            {
                FirstName = "Joshua",
                LastName  = "Tomson",
                Age       = 15,
                Grade     = 9
            });

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
        }
        public void PostStudent_WhenFirstNameIsNull_ShouldReturnStatusCode400()
        {
            var mockRepository = Mock.Create <IStudentRepository <Student> >();

            Mock.Arrange(() => mockRepository
                         .Add(Arg.Matches <Student>(student => student.FirstName == null)))
            .Throws <NullReferenceException>();


            var server =
                new InMemoryHttpServer <Student>("http://localhost/", mockRepository);

            var response = server.CreatePostRequest("api/students",
                                                    new Student()
            {
                LastName = "Tomson",
                Age      = 15,
                Grade    = 9
            });

            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
        }