public async Task EditAsyncThrowsWhenTheInputModelIsNull()
        {
            // Arrange
            var mapperMock     = new Mock <IMapper>();
            var repositoryMock = new Mock <IDeletableEntityRepository <Boulder> >();

            var bouldersService = new BouldersService(repositoryMock.Object, mapperMock.Object);

            // Assert
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                // Act
                await bouldersService.EditAsync("validId", null, new ImageInputModel());
            });
        }
        public async Task EditAsyncEditsThePorpertiesAndSavesTheChanges(
            string name,
            string description,
            string gradeId,
            string gymId,
            string newName,
            string newDescription,
            string newGradeId,
            string newGymId,
            bool imageNull,
            string imageSource,
            string newImageSource)
        {
            // Arrange
            AutoMapperConfig.RegisterMappings(typeof(Test).Assembly, typeof(ErrorViewModel).Assembly);
            var saved = true;

            var boulder = new Boulder()
            {
                Name        = name,
                Description = description,
                GradeId     = gradeId,
                GymId       = gymId,
                Image       = new Image()
                {
                    Source = imageSource,
                },
            };

            var bouldersList = new List <Boulder>()
            {
                new Boulder(),
                new Boulder(),
                new Boulder(),
                boulder,
                new Boulder(),
                new Boulder(),
            };

            var repositoryMock = new Mock <IDeletableEntityRepository <Boulder> >();

            repositoryMock.Setup(x => x.All())
            .Returns(bouldersList.AsQueryable());

            repositoryMock.Setup(x => x.SaveChangesAsync())
            .Callback(() =>
            {
                saved = true;
            });

            var boulderEditModel = new BoulderInputModel()
            {
                Name        = newName,
                Description = newDescription,
                GymId       = newGymId,
                GradeId     = newGradeId,
            };

            var imageEditModel = new ImageInputModel()
            {
                Source = newImageSource,
            };

            if (imageNull)
            {
                imageEditModel = null;
            }

            var bouldersService = new BouldersService(repositoryMock.Object, AutoMapperConfig.MapperInstance);

            // Act
            await bouldersService.EditAsync(boulder.Id, boulderEditModel, imageEditModel);

            // Assert
            Assert.True(saved);

            Assert.Equal(newName, boulder.Name);
            Assert.Equal(newDescription, boulder.Description);
            Assert.Equal(newGradeId, boulder.GradeId);
            Assert.Equal(newGymId, boulder.GymId);

            var actualImage = boulder.Image;

            if (imageNull)
            {
                Assert.Equal(imageSource, actualImage.Source);
            }
            else
            {
                Assert.Equal(newImageSource, actualImage.Source);
            }
        }