Пример #1
0
        public void A_newly_adopted_animal_starts_with_a_neutral_happiness_level()
        {
            var userId   = "user_4_petting_animal";
            var animalId = string.Format("{0}|mouse_1", userId);

            var url      = string.Format("http://localhost/v1/user/{0}/adopt/mouse", userId);
            var response = _httpService.Put(
                url,
                new
            {
                UserId   = userId,
                AnimalId = animalId
            });

            Assert.IsTrue(response.IsSuccessStatusCode);

            var animal = GetAnimal(animalId);

            Assert.AreEqual(Neutral, animal.Happiness);
        }
Пример #2
0
        public void A_user_can_adopt_animal_of_x_types(string animalType)
        {
            var userId   = "user_2_adoption";
            var animalId = string.Format("{0}|{1}_1", userId, animalType);

            var url = string.Format("http://localhost/v1/user/{0}/adopt/{1}", userId, animalType);

            var response = _httpService.Put(
                url,
                new
            {
                UserId   = userId,
                AnimalId = animalId
            });

            Assert.IsTrue(response.IsSuccessStatusCode);

            var user = GetUser(userId);

            Assert.IsNotEmpty(user.AnimalIds);
            Assert.True(user.AnimalIds.Contains(animalId));
        }