Example #1
0
        public void PostInvalidJsonBooking()
        {
            BookController bc = new BookController();
            string dummyPost = "{bookReference: \"abc12\", >>>> some random junk here <<<< car:{category: 1, model: 1, year: 2012},driver:{age: 28, firstName: \"John\", lastName: \"Doe\"}, dropoffDate: \"2016-02-20T00:00:00-02:00\", hasAgeExtraFee: false, pickupDate: \"2016-02-07T00:00:00-02:00\"}";

            Assert.True(bc.Post(dummyPost).StatusCode == HttpStatusCode.BadRequest);
        }
Example #2
0
        public void PostValidBooking()
        {
            BookController bc = new BookController();
            string dummyPost = "{bookReference: \"abc12\", car:{category: 0, model: 1, year: 2015}, driver:{age: 28, firstName: \"John\", lastName: \"Doe\"}, dropoffDate: \"2016-02-20T00:00:00-02:00\", hasAgeExtraFee: false, pickupDate: \"2016-02-07T00:00:00-02:00\"}";

            Assert.True(bc.Post(dummyPost).StatusCode == HttpStatusCode.OK);
        }
Example #3
0
        public void PostNullBooking()
        {
            BookController bc = new BookController();
            string dummyPost = "";

            Assert.True(bc.Post(dummyPost).StatusCode == HttpStatusCode.BadRequest);

            dummyPost = null;

            Assert.True(bc.Post(dummyPost).StatusCode == HttpStatusCode.BadRequest);
        }
Example #4
0
 public void DeleteInvalidBooking()
 {
     BookController bc = new BookController();
     Assert.True(bc.Delete("randomnumberreferencethatprobablydontexist").StatusCode == HttpStatusCode.BadRequest);
 }