public void Should_overwrite_existing_mod_object() { var storageProvider = new Mock <IStorageProvider>(); var mapper = new Mock <IMapper>(); var gameService = new Mock <IGameService>(); var modExport = new Mock <IModCollectionExporter>(); SetupMockCase(storageProvider, gameService); var service = new ModCollectionService(null, null, new Cache(), null, null, null, null, gameService.Object, modExport.Object, storageProvider.Object, mapper.Object); var result = service.Save(new ModCollection() { Name = "test", Game = "test" }); result.Should().BeTrue(); service.GetAll().Count().Should().Be(2); }
public void Should_throw_exception_when_saving_mod_object_with_no_game() { var storageProvider = new Mock <IStorageProvider>(); var mapper = new Mock <IMapper>(); var gameService = new Mock <IGameService>(); var modExport = new Mock <IModCollectionExporter>(); SetupMockCase(storageProvider, gameService); var service = new ModCollectionService(null, null, new Cache(), null, null, null, null, gameService.Object, modExport.Object, storageProvider.Object, mapper.Object); Exception exception = null; try { service.Save(new ModCollection()); } catch (Exception ex) { exception = ex; } exception.GetType().Should().Be(typeof(ArgumentNullException)); }