public void InstantiatePackage_IfPackageDoesntExist() { var packages = new Mock <ICollection <IPackage> >(); var logger = new Mock <ILogger>(); var packageRepository = new PackageRepositoryFake(logger.Object, null); Assert.IsInstanceOf <ICollection <IPackage> >(packageRepository.PackagesFake); }
public void ThrowArgumentNullException_WhenPassedNullPackage() { var package = new Mock <IPackage>(); var logger = new Mock <ILogger>(); var packages = new List <IPackage>() { package.Object }; var packageRepository = new PackageRepositoryFake(logger.Object, packages); Assert.Throws <ArgumentNullException>(() => packageRepository.Delete(package.Object), null); }
public void ThrowArgumentNullException_WhenLoggerValueIsNull() { var package = new Mock <IPackage>(); var logger = new Mock <ILogger>(); var packages = new List <IPackage>() { package.Object }; var packageRepository = new PackageRepositoryFake(logger.Object, packages); Assert.Throws <ArgumentNullException>(() => new PackageRepositoryFake(null, packages)); }
public void TestValidPackage() { var package = new Mock <IPackage>(); package.Setup(x => x.Name).Returns("name"); var logger = new Mock <ILogger>(); var packages = new List <IPackage>() { package.Object }; var packageRepository = new PackageRepositoryFake(logger.Object, packages); Assert.Throws <ArgumentNullException>(() => packageRepository.Delete(package.Object), "not exist"); }
public void SetCorrectLoggerValue_WhenValueIsNotNull() { var package = new Mock <IPackage>(); var logger = new Mock <ILogger>(); var packages = new List <IPackage>() { package.Object }; var packageRepository = new PackageRepositoryFake(logger.Object, packages); packageRepository.Add(package.Object); Assert.AreEqual(logger.Object, packageRepository.LoggerFake); }
public void SetCorrectPackageValue() { var package = new Mock <IPackage>(); var logger = new Mock <ILogger>(); var packages = new List <IPackage>() { package.Object }; var packageRepository = new PackageRepositoryFake(logger.Object, packages); packageRepository.Add(package.Object); Assert.AreEqual(packages, packageRepository.PackagesFake); }