Beispiel #1
0
        public void Constructor_ShouldCallRestorePackagesMethod_WhenConstructed()
        {
            // Arrange
            var downloadMock = new Mock <IDownloader>();

            var packageDependencyMock = new Mock <IPackage>();

            var packageMock = new Mock <IPackage>();

            packageMock.SetupGet(p => p.Dependencies).Returns(new HashSet <IPackage>()
            {
                packageDependencyMock.Object
            });

            var projectMock = new Mock <IProject>();

            projectMock.Setup(p => p.PackageRepository.GetAll()).Returns(new List <IPackage>()
            {
                packageMock.Object
            });


            // Act
            var packageInstaller = new ExtendedPackageInstaller(downloadMock.Object, projectMock.Object);

            // Assert
            Assert.IsTrue(packageInstaller.IsItCalled);
        }
Beispiel #2
0
        public void AssignProjectValueCorrectly_WhenInputParamsAreValid()
        {
            // Arrange
            var downloaderMock = new Mock <IDownloader>();
            var projectMock    = new Mock <IProject>();

            projectMock.Setup(x => x.PackageRepository.GetAll()).Returns(new List <IPackage>());

            // Act
            var packageInstaller = new ExtendedPackageInstaller(downloaderMock.Object, projectMock.Object);

            // Assert
            Assert.AreSame(projectMock.Object, packageInstaller.Project);
        }
Beispiel #3
0
        public void ShouldCallRestorePackagesMehtod_WhenInputParamsAreValid()
        {
            // Arrange
            var downloaderMock = new Mock <IDownloader>();
            var projectMock    = new Mock <IProject>();

            projectMock.Setup(x => x.PackageRepository.GetAll()).Returns(new List <IPackage>());

            // Act
            var packageInstaller = new ExtendedPackageInstaller(downloaderMock.Object, projectMock.Object);

            // Assert
            // The project.PackageRepository.GetAll() method is called from the inside of the RestorePackages() Mehtod
            projectMock.Verify(x => x.PackageRepository.GetAll(), Times.Once);
        }