public void HistoryApp_Delete_Get_Null_Id_Should_Return_Error()
        {
            // Arrange
            var controller = new HistoryAppController();

            // Act
            var result = controller.Delete((string)null) as NotFoundResult;

            // Assert
            Assert.AreEqual(404, result.StatusCode);
        }
示例#2
0
        public void HistoryApp_Delete_InValid_Data_Bogus_Should_Fail()
        {
            // Arrange
            var myController = new HistoryAppController();

            // Act
            var result = myController.Delete("bogus");

            // Assert
            Assert.IsNotNull(result);
        }
        public void HistoryApp_Delete_Get_Data_Null_Should_Fail()
        {
            // Arrange
            var myController = new HistoryAppController();

            // Act
            var result = myController.Delete(null);

            // Reset

            // Assert
            Assert.IsNotNull(result);
        }
        public void HistoryApp_Delete_Invalid_Null_Data_Should_Return_Error()
        {
            // Arrange
            var    controller = new HistoryAppController();
            string id         = "bogus";

            // Act
            var result = controller.Delete(id) as NotFoundResult;

            // Reset
            BiliWeb.Backend.DataSourceBackend.Instance.Reset();

            // Assert
            Assert.AreEqual(404, result.StatusCode);
        }
        public void HistoryApp_Delete_Get_Default_Should_Return_Data()
        {
            // Arrange
            var controller = new HistoryAppController();

            // Get default student
            var data = BiliWeb.Backend.DataSourceBackend.Instance.HistoryAppBackend.Index().FirstOrDefault();

            // Act
            var result = controller.Delete(data.ID, true) as ViewResult;

            // Reset

            // Assert
            Assert.IsNotNull(result.ViewData);
        }
        public void HistoryApp_Delete_Get_Default_Should_Pass()
        {
            // Arrange
            var controller = new HistoryAppController();

            string id = BiliWeb.Backend.DataSourceBackend.Instance.HistoryAppBackend.Index().FirstOrDefault().ID;

            // Act
            ViewResult result = controller.Delete(id) as ViewResult;

            // Reset
            BiliWeb.Backend.DataSourceBackend.Instance.Reset();

            // Assert
            Assert.IsNotNull(result);
        }