Exemplo n.º 1
0
        public async Task GetSpotByIdAsync_SpotExists_ShouldReturnTheSpot()
        {
            // Arrange
            expectedSpot.Region = fixture.Create <Region>();
            spotId = expectedSpot.Id;
            context.Add(expectedSpot);
            context.SaveChanges();

            //Act
            var actualSpot = await repository.GetSpotByIdAsync(spotId);

            //Assert
            Assert.AreEqual(expectedSpot, actualSpot);
        }
Exemplo n.º 2
0
        private async Task CheckSpotExists(int id)
        {
            var spot = await repository.GetSpotByIdAsync(id);

            if (spot == null)
            {
                throw new KeyNotFoundException("The spot doesn't exists.");
            }
        }