public void IsPackageInstalled_NullParameters_ThrowsException()
        {
            // Arrange
            var project = new Mock <EnvDTE.Project>();

            // Act & Assert
            VsPackageInstallerServices target = CreateTarget();

            Assert.Throws <ArgumentException>(() => target.IsPackageInstalled(project.Object, null));
            Assert.Throws <ArgumentException>(() => target.IsPackageInstalled(project.Object, string.Empty));
            Assert.Throws <ArgumentNullException>(() => target.IsPackageInstalled(null, "packageId"));
        }
        public void IsPackageInstalled_InternalException_PostsFault()
        {
            // Arrange
            var expectedException = new ArgumentException("Internal error");

            var solutionManager = new Mock <IVsSolutionManager>();

            solutionManager.SetupGet(s => s.SolutionDirectory)
            .Throws(expectedException);

            var telemetryProvider = new Mock <INuGetTelemetryProvider>();

            var project = new Mock <EnvDTE.Project>();

            // Act
            VsPackageInstallerServices target = CreateTarget(vsSolutionManager: solutionManager.Object, telemetryProvider: telemetryProvider.Object);
            var actualException = Assert.Throws <ArgumentException>(() => target.IsPackageInstalled(project.Object, "packageId"));

            // Assert
            telemetryProvider.Verify(t => t.PostFaultAsync(expectedException, typeof(VsPackageInstallerServices).FullName, nameof(VsPackageInstallerServices.IsPackageInstalled), It.IsAny <IDictionary <string, object> >()));
            telemetryProvider.VerifyNoOtherCalls();
            Assert.Equal(expectedException, actualException);
        }