示例#1
0
        public void BeersApiController_GetOne()
        {
            BeersApiController controller           = new BeersApiController(new FakeRepositories.FakeBeerRepository());
            OkNegotiatedContentResult <Beer> result = controller.GetBeer(10) as OkNegotiatedContentResult <Beer>;

            Assert.IsNotNull(result);
        }
示例#2
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);
        }