Exemple #1
0
        public async Task Create_Cat_Successful()
        {
            var cat = new Cat(Guid.NewGuid().ToString(), Ability.Napping);

            await CatService.Create(cat);

            MessageBrokerMock.Verify(MessageCommand.Create);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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));
 }