Exemplo n.º 1
0
        public void BeersApiController_Edit()
        {
            BeersApiController controller = new BeersApiController(new FakeRepositories.FakeBeerRepository());
            Beer beer = new Beer()
            {
                BeerId    = 1,
                Name      = "GreasyKev",
                Type      = "Ale",
                UnitPrice = 1,
                ABV       = 1
            };

            System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <Beer> createBeer = controller.PostBeer(beer) as CreatedAtRouteNegotiatedContentResult <Beer>;
            IHttpActionResult edit = controller.PutBeer(10, beer) as IHttpActionResult;

            Assert.IsNotNull(createBeer);
            Assert.IsNotNull(edit);
        }
Exemplo n.º 2
0
        public void BeersApiController_AddAction()
        {
            BeersApiController controller = new BeersApiController(new FakeRepositories.FakeBeerRepository());
            Beer beer = new Beer()
            {
                BeerId    = 1,
                Name      = "Blue Brew",
                Type      = "Ale",
                UnitPrice = 69,
                ABV       = 69
            };

            System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <Beer> result = controller.PostBeer(beer) as CreatedAtRouteNegotiatedContentResult <Beer>;
            Assert.IsNotNull(result);
        }
Exemplo n.º 3
0
        public void BeersApiController_DeleteAction()
        {
            BeersApiController controller = new BeersApiController(new FakeRepositories.FakeBeerRepository());

            Beer beer = new Beer()
            {
                BeerId    = 1,
                Name      = "BeeBrew",
                Type      = "Ale",
                UnitPrice = 5,
                ABV       = 4
            };

            System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <Beer> createBeer = controller.PostBeer(beer) as CreatedAtRouteNegotiatedContentResult <Beer>;
            System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <Beer> delete     = controller.DeleteBeer(1) as CreatedAtRouteNegotiatedContentResult <Beer>;
            System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <Beer> result     = controller.GetBeer(1) as CreatedAtRouteNegotiatedContentResult <Beer>;
            Assert.IsNotNull(createBeer);
            Assert.IsNull(result);
        }