public void ThrowsArgumentNullException_WhenFileUtils_IsNull() { // Arrange var tracksServiceFake = new Mock <ITracksService>(); var challengesServiceFake = new Mock <IChallengesService>(); var mapperFake = new Mock <IMappingProvider>(); var fileSystemFake = new Mock <IFileSystemService>(); IFileUnits fileUtils = null; // Act & Assert Assert.Throws <ArgumentNullException>(() => new ChallengeController( tracksServiceFake.Object, challengesServiceFake.Object, fileSystemFake.Object, mapperFake.Object, fileUtils)); }
public ChallengeController( ITracksService tracks, IChallengesService challenges, IFileSystemService fileSystem, IMappingProvider mapper, IFileUnits fileUtils) { Guard.WhenArgument(tracks, nameof(tracks)).IsNull().Throw(); Guard.WhenArgument(mapper, nameof(mapper)).IsNull().Throw(); Guard.WhenArgument(challenges, nameof(challenges)).IsNull().Throw(); Guard.WhenArgument(fileSystem, nameof(fileSystem)).IsNull().Throw(); Guard.WhenArgument(fileUtils, nameof(fileUtils)).IsNull().Throw(); this.tracks = tracks; this.mapper = mapper; this.challenges = challenges; this.fileSystem = fileSystem; this.fileUtils = fileUtils; }