Ejemplo n.º 1
0
        public async void PetsFunctionalityTest()
        {
            _token = await _accountManagementService.SignIn(TestingObjectProvider.Instance.Login);

            Assert.NotNull(_token);

            var pet = TestingObjectProvider.Instance.Pet;

            Assert.NotNull(await _petsManagementService.GetAllPets(_token.Jwt));
            Assert.NotNull(await _petsManagementService.GetPet(pet.Id, _token.Jwt));
            Assert.True(await _petsManagementService.CreatePet(pet, _token.Jwt));
            Assert.True(await _petsManagementService.UpdatePet(pet, _token.Jwt));

            var exception = Record.Exception(() => _petsManagementService.UpdatePet(null, _token.Jwt).Result);

            Assert.IsType(typeof(NullReferenceException), exception?.InnerException);

            Assert.False(await _petsManagementService.CreatePet(null, _token.Jwt));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(PetViewModel pet, CancellationToken cancellationToken)
        {
            if (ModelState.IsValid)
            {
                if (await _petsManagementService.UpdatePet(pet.ThePet, CurrentCookiesToken, cancellationToken))
                {
                    return(Json(new { success = true }));
                }

                CheckUnexpectedErrors();
                return(PartialView(pet));
            }

            return(PartialView(pet));
        }
Ejemplo n.º 3
0
 public void TestOfUpdatingPet()
 {
     Assert.True(_petsManagementService.UpdatePet(_testingPet, _token.Jwt).Result);
 }