コード例 #1
0
        public void GetAll_TestEntity()
        {
            var newEntity1 = new SampleTestEntity()
            {
                Name = "test entity 1", HardProperty = new string[] { "test1A", "test1B" }
            };
            int?returnId1 = _SampleEntityService.AddSampleTestEntity(newEntity1).GetAwaiter().GetResult();

            Assert.IsNotNull(returnId1, "Addition of 2nd entity caused error");

            var newEntity2 = new SampleTestEntity()
            {
                Name = "test entity 2", HardProperty = new string[] { "test2A", "test2B" }
            };
            int?returnId2 = _SampleEntityService.AddSampleTestEntity(newEntity2).GetAwaiter().GetResult();

            Assert.IsNotNull(returnId2, "Addition of 2nd entity caused error");

            var result = _SampleEntityService.GetSampleTestEntityList(e => e.Id != null).GetAwaiter().GetResult();

            Assert.IsNotNull(result, "Entity list was not available");
            Assert.AreEqual(result.Count, 2, "Entity list was not as expected");
        }
コード例 #2
0
 // GET: SampleTestEntities
 public async Task <IActionResult> Index()
 {
     _logger?.LogInformation("List SampleTestEntities action called");
     return(View(await _service.GetSampleTestEntityList(e => e != null)));
 }