コード例 #1
0
        public void PostSoftware_ShouldReturnSameSoftware()
        {
            var controller = new SoftwaresController(GetDemoContext());
            var item = GetDemoSoftware();

            var result = controller.PostSoftware(item) as CreatedAtRouteNegotiatedContentResult<Software>;

            Assert.IsNotNull(result);
            Assert.AreEqual(result.RouteName, "DefaultApi");
            Assert.AreEqual(result.RouteValues["id"], result.Content.SoftwareId);
            Assert.AreEqual(result.Content.Name, item.Name);
        }
コード例 #2
0
        public void PostSoftware_ShouldFail_WhenInvalidManufacturerId()
        {
            var controller = new SoftwaresController(new TestLicenseManagerContext());
            var item = GetDemoSoftware();

            var result = controller.PostSoftware(item);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
        }