public void WhenCreateCalled_ThenPhotoPersists()
        {
            var repository = new VehiclePhotoRepository();
            var photo = new VehiclePhoto
                            {
                                ImageMimeType = "image/jpeg",
                                Image = new byte[1]
                            };
            repository.Create(1, photo);

            var repository2 = new VehiclePhotoRepository();
            Assert.NotNull(repository2.Get(1));
        }
        public void WhenCreateCalled_ThenPhotoPersists()
        {
            var repository = new VehiclePhotoRepository();
            var photo      = new VehiclePhoto
            {
                ImageMimeType = "image/jpeg",
                Image         = new byte[1]
            };

            repository.Create(1, photo);

            var repository2 = new VehiclePhotoRepository();

            Assert.NotNull(repository2.Get(1));
        }
        public void WhenDeleteCalled_ThenPhotoNuked()
        {
            const int vehicleId = 1;
            var repository = new VehiclePhotoRepository();
            var photo = new VehiclePhoto
                            {
                                ImageMimeType = "image/jpeg",
                                Image = new byte[1]
                            };
            repository.Create(vehicleId, photo);
            repository.Delete(photo.Id);

            var repository2 = new VehiclePhotoRepository();
            Assert.Null(repository2.Get(photo.Id));
        }
Esempio n. 4
0
        public void WhenCreateCalled_ThenPhotoPersists()
        {
            DatabaseTestUtility.DropCreateMileageStatsDatabase();
            var repository = new VehiclePhotoRepository(new MileageStatsDbContext());
            var photo      = new Model.VehiclePhoto()
            {
                ImageMimeType = "image/jpeg",
                Image         = new byte[1]
            };

            repository.Create(1, photo);

            var repository2 = new VehiclePhotoRepository(new MileageStatsDbContext());

            Assert.NotNull(repository2.Get(1));
        }
        public void WhenDeleteCalled_ThenPhotoNuked()
        {
            const int vehicleId  = 1;
            var       repository = new VehiclePhotoRepository();
            var       photo      = new VehiclePhoto
            {
                ImageMimeType = "image/jpeg",
                Image         = new byte[1]
            };

            repository.Create(vehicleId, photo);
            repository.Delete(photo.Id);

            var repository2 = new VehiclePhotoRepository();

            Assert.Null(repository2.Get(photo.Id));
        }
Esempio n. 6
0
        public void WhenDeleteCalled_ThenPhotoNuked()
        {
            DatabaseTestUtility.DropCreateMileageStatsDatabase();
            var repository = new VehiclePhotoRepository(new MileageStatsDbContext());
            var photo      = new Model.VehiclePhoto()
            {
                ImageMimeType = "image/jpeg",
                Image         = new byte[1]
            };

            repository.Create(1, photo);

            var photoToEdit = repository.Get(1);

            repository.Delete(photoToEdit.VehiclePhotoId);

            var repository2 = new VehiclePhotoRepository(new MileageStatsDbContext());

            Assert.Throws <InvalidOperationException>(() => repository2.Get(1));
        }