Exemplo n.º 1
0
        public async void DeleteSoftware_Returns_OK()
        {
            var query = new SoftwaresController(context);

            var result = await query.DeleteSoftware(3);  // async

            Assert.IsType <ActionResult <Software> >(result);
        }
Exemplo n.º 2
0
        public async void DeleteSoftware_Delete_Id_3()
        {
            var query = new SoftwaresController(context);

            SeedCases(context);
            var result = await query.DeleteSoftware(3);  // async

            Assert.Equal("Row&Go!", result.Value.Name);
        }
        public void DeleteSoftware_ShouldReturnOk()
        {
            var context = GetDemoContext();
            var item    = GetDemoSoftware();

            context.Softwares.Add(item);
            var controller = new SoftwaresController(context);

            var result = controller.DeleteSoftware(item.SoftwareId) as OkNegotiatedContentResult <Software>;

            Assert.IsNotNull(result);
            Assert.AreEqual(item.SoftwareId, result.Content.SoftwareId);
        }
Exemplo n.º 4
0
        public async void DeleteSoftware_Delete_Id_2_With_Cases()
        {
            var query = new SoftwaresController(context);

            SeedCases(context);

            var result = await query.DeleteSoftware(2);  // async

            var badRequestResult = Assert.IsType <BadRequestObjectResult>(result.Result);

            Assert.Contains("cannot delete", badRequestResult.Value.ToString());
            Assert.Equal(400, badRequestResult.StatusCode);
            Assert.IsType <BadRequestObjectResult>(result.Result);
        }