public async Task <IActionResult> Create([Bind("Id,Name,HardProperty")] SampleTestEntity SampleTestEntity) { if (ModelState.IsValid) { await _service.AddSampleTestEntity(SampleTestEntity); return(RedirectToAction(nameof(Index))); } return(View(SampleTestEntity)); }
public void Add_SampleTestEntity() { var newEntity = new SampleTestEntity() { Name = "test entity", HardProperty = new string[] { "testA", "testB" } }; int?returnId = _SampleEntityService.AddSampleTestEntity(newEntity).GetAwaiter().GetResult(); Assert.IsNotNull(returnId, "Entity was not added"); Assert.Greater(returnId, 0, "Entity count was not updated"); }