public async Task Create_Cat_Successful() { var cat = new Cat(Guid.NewGuid().ToString(), Ability.Napping); await CatService.Create(cat); MessageBrokerMock.Verify(MessageCommand.Create); }
private IServiceTest Execute() { using (var context = new CatSharpContext(base.Options)) { var service = new CatService(context); service.Create(new CatCreateDto("Cat 1", new DateTime(2018, 01, 01), null)); } return(this); }
public ActionResult <Cat> Create([FromBody] Cat newCat) { try { return(Ok(_cs.Create(newCat))); } catch (Exception err) { return(BadRequest(err.Message)); } }
public ActionResult CreateCat(Cat model) { Cat princess = new Cat(); princess.Name = "Princess"; princess.Sex = 'F'; princess.Weight = 7.4f; CatService catService = new CatService(); catService.Create(princess); return(Content("ok")); }
public ActionResult <Cat> Create(Cat cat) { _catService.Create(cat); return(CreatedAtRoute("GetCat", new { id = cat.Id.ToString() }, cat)); }