コード例 #1
0
        public void EndProjectUpdate_WhenBatchEventEndIsRaisedWithNonProject_DoesNotFireStartProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);
            int invocations           = 0;

            restoreProgressEvents.ProjectUpdateFinished += (projectUniqueName, updatedFiles) =>
            {
                invocations++;
            };

            _packageProjectEvents.NotifyBatchEnd(new PackageProjectEventArgs("id", "name", null));

            Assert.Equal(0, invocations);
        }
コード例 #2
0
        public void EndSolutionRestore_WithValidProjectName_FiresProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);
            var expectedProjectList   = new List <string>()
            {
                "projectName.csproj"
            };

            IReadOnlyList <string> actualProjectList = null;

            restoreProgressEvents.SolutionRestoreFinished += (updatedFiles) =>
            {
                actualProjectList = updatedFiles;
            };

            restoreProgressEvents.EndSolutionRestore(expectedProjectList);

            Assert.Equal(expectedProjectList, actualProjectList);
        }
        public void StartSolutionRestore_WithValidProjectName_FiresProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents();

            var expectedProjectList = new List <string>()
            {
                "projectName.csproj"
            };

            IReadOnlyList <string> actualProjectList = null;

            restoreProgressEvents.SolutionRestoreStarted += (updatedFiles) =>
            {
                actualProjectList = updatedFiles;
            };

            restoreProgressEvents.StartSolutionRestore(expectedProjectList);

            Assert.Equal(expectedProjectList, actualProjectList);
        }
        public void EndProjectUpdate_WithValidProjectName_FiresProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents();

            var expectedProjectName  = "projectName.csproj";
            var expectedFileListName = new List <string>()
            {
                "project.assets.json"
            };

            string actualProjectName = null;
            IReadOnlyList <string> actualFileListName = null;

            restoreProgressEvents.ProjectUpdateFinished += (projectUniqueName, updatedFiles) =>
            {
                actualProjectName  = projectUniqueName;
                actualFileListName = updatedFiles;
            };

            restoreProgressEvents.EndProjectUpdate(expectedProjectName, expectedFileListName);

            Assert.Equal(expectedProjectName, actualProjectName);
            Assert.Equal(expectedFileListName, actualFileListName);
        }
コード例 #5
0
        public void StartProjectUpdate_WithValidProjectName_FiresProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);

            var expectedProjectName  = "projectName.csproj";
            var expectedFileListName = new List <string>()
            {
                "project.assets.json"
            };

            string actualProjectName = null;
            IReadOnlyList <string> actualFileListName = null;

            restoreProgressEvents.ProjectUpdateStarted += (projectUniqueName, updatedFiles) =>
            {
                actualProjectName  = projectUniqueName;
                actualFileListName = updatedFiles;
            };

            restoreProgressEvents.StartProjectUpdate(expectedProjectName, expectedFileListName);

            Assert.Equal(expectedProjectName, actualProjectName);
            Assert.Equal(expectedFileListName, actualFileListName);
        }
コード例 #6
0
        public void EndProjectUpdate_WhenBatchEventEndIsRaised_FiresStartProjectUpdateEvent()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);

            var expectedProjectName  = "projectName.csproj";
            var expectedFileListName = new List <string>()
            {
                expectedProjectName
            };

            string actualProjectName = null;
            IReadOnlyList <string> actualFileListName = null;

            restoreProgressEvents.ProjectUpdateFinished += (projectUniqueName, updatedFiles) =>
            {
                actualProjectName  = projectUniqueName;
                actualFileListName = updatedFiles;
            };

            _packageProjectEvents.NotifyBatchEnd(new PackageProjectEventArgs("id", "name", expectedProjectName));

            Assert.Equal(expectedProjectName, actualProjectName);
            Assert.Equal(expectedFileListName, actualFileListName);
        }
        public void StartSolutionRestore_WithEmptyProjectList_ThrowsArgumentException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents();

            Assert.Throws <ArgumentException>(() => restoreProgressEvents.StartSolutionRestore(new List <string>()));
        }
        public void StartSolutionRestore_WithNullProjectList_ThrowsArgumentException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents();

            Assert.Throws <ArgumentException>(() => restoreProgressEvents.StartSolutionRestore(null));
        }
        public void EndProjectUpdate_WithNullProjectName_ThrowsArgumentNullException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents();

            Assert.Throws <ArgumentNullException>(() => restoreProgressEvents.EndProjectUpdate(null, new string[] { }));
        }
コード例 #10
0
 public void Constructor_EmptyParamConstructor()
 {
     _ = new VsRestoreProgressEvents();
 }
コード例 #11
0
        public void EndProjectUpdate_WithNullProjectName_ThrowsArgumentNullException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);

            Assert.Throws <ArgumentNullException>(() => restoreProgressEvents.EndProjectUpdate(null, new string[] { }));
        }
コード例 #12
0
 public void Constructor_WithNonNullParameters_Succeeds()
 {
     _ = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);
 }
コード例 #13
0
        public void EndSolutionRestore_WithEmptyProjectList_ThrowsArgumentException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);

            Assert.Throws <ArgumentException>(() => restoreProgressEvents.EndSolutionRestore(new List <string>()));
        }
コード例 #14
0
        public void StartSolutionRestore_WithNullProjectList_ThrowsArgumentException()
        {
            var restoreProgressEvents = new VsRestoreProgressEvents(_packageProjectProvider.Object, new Mock <INuGetTelemetryProvider>().Object);

            Assert.Throws <ArgumentException>(() => restoreProgressEvents.StartSolutionRestore(null));
        }