Esempio n. 1
0
        public async void GetDetailsNotFound()
        {
            using (var database = new TestDb())
            {
                var controller = new BreedsController(database.Context);

                IActionResult result = await controller.Details(50);

                CheckMessage(result, "The selected Breed could not be found.");
            }
        }
Esempio n. 2
0
        public async void GetDetailsNullId()
        {
            using (var database = new TestDb())
            {
                var controller = new BreedsController(database.Context);

                IActionResult result = await controller.Details(null);

                CheckMessage(result, "The Breed ID provided was invalid.");
            }
        }
Esempio n. 3
0
        public async void GetDetailsNegativeId()
        {
            using (var database = new TestDb())
            {
                var controller = new BreedsController(database.Context);

                IActionResult result = await controller.Details(-1);

                CheckMessage(result, $"The Breed ID must be between 1 and {int.MaxValue}.");
            }
        }
Esempio n. 4
0
        public async void GetDetailsFound()
        {
            using (var database = new TestDb())
            {
                var controller = new BreedsController(database.Context);

                IActionResult result = await controller.Details(8);

                BreedViewModel viewModel = CheckViewModel(result);
                Breed          breed     = database.Context.Breeds.SingleOrDefault(b => b.Id == 8);

                Assert.Equal(8, viewModel.Breed.Id);
                Assert.Equal(breed.Name, viewModel.Breed.Name);
            }
        }