コード例 #1
0
        public void Delete_SampleTestEntity()
        {
            var newEntity = new SampleTestEntity()
            {
                Name = "test entity", HardProperty = new string[] { "testA", "testB" }
            };
            int?returnId = _SampleEntityService.AddSampleTestEntity(newEntity).GetAwaiter().GetResult();

            Assert.IsNotNull(returnId, "Addition of entity caused error");

            var result = _SampleEntityService.DeleteSampleTestEntity(newEntity.Id).GetAwaiter().GetResult();

            Assert.IsNotNull(result, "Entity could not be deleted");
            Assert.Greater(result, 0, "Entity deletion was not as expected");
        }
コード例 #2
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            await _service.DeleteSampleTestEntity(id);

            return(RedirectToAction(nameof(Index)));
        }