Example #1
0
 public void BeforeEach()
 {
     CredentialsStore.Default.UpdateCurrentProject(Mock.Of <Project>(p => p.ProjectId == DefaultProjectId));
     _closeWindowMock = new Mock <Action>();
     GoogleCloudExtensionPackageTests.InitPackageMock(
         dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2017Version));
 }
Example #2
0
        public void BeforeEach()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(dte => { });

            _promptOptions     = new List <UserPromptWindow.Options>();
            _promptReturnValue = true;
            UserPromptWindow.PromptUserFunction = options =>
            {
                _promptOptions.Add(options);
                return(_promptReturnValue);
            };

            _deleteSubscriptionSource = new TaskCompletionSource <object>();
            _refreshSource            = new TaskCompletionSource <object>();

            _ownerMock = new Mock <ITopicViewModelBase>();
            _ownerMock.Setup(o => o.Context.ShowPropertiesWindow(It.IsAny <object>()));
            _ownerMock.Setup(o => o.DataSource.DeleteSubscriptionAsync(It.IsAny <string>()))
            .Returns(_deleteSubscriptionSource.Task);
            _ownerMock.Setup(o => o.Refresh()).Returns(_refreshSource.Task);

            _subscriptionItemMock = new Mock <Subscription>();
            _subscriptionItemMock.Setup(s => s.Name).Returns(MockSubscriptionFullName);
            _subscriptionItemMock.Setup(s => s.Topic).Returns(MockTopicFullName);

            _objectUnderTest = new SubscriptionViewModel(_ownerMock.Object, _subscriptionItemMock.Object);
        }
        public void BeforeEach()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(dte => { });

            _newSubscriptionSource     = new TaskCompletionSource <Subscription>();
            _getSubscriptionListSource = new TaskCompletionSource <IList <Subscription> >();
            _deleteTopicSource         = new TaskCompletionSource <object>();

            _ownerMock = new Mock <IPubsubSourceRootViewModel>();
            _ownerMock.Setup(o => o.Context.ShowPropertiesWindow(It.IsAny <object>()));
            _ownerMock.Setup(o => o.DataSource.NewSubscriptionAsync(It.IsAny <Subscription>()))
            .Returns(_newSubscriptionSource.Task);
            _ownerMock.Setup(o => o.DataSource.GetSubscriptionListAsync()).Returns(_getSubscriptionListSource.Task);
            _ownerMock.Setup(o => o.DataSource.DeleteTopicAsync(It.IsAny <string>())).Returns(_deleteTopicSource.Task);

            _objectUnderTest = new TopicViewModel(_ownerMock.Object, _topicItem, new List <Subscription>());

            _newSubscriptionPromptParameter            = null;
            _newSubscriptionPromptReturnValue          = null;
            _objectUnderTest.NewSubscriptionUserPrompt = s =>
            {
                _newSubscriptionPromptParameter = s;
                return(_newSubscriptionPromptReturnValue);
            };

            _promptUserOptions     = new List <UserPromptWindow.Options>();
            _promptUserReturnValue = true;
            UserPromptWindow.PromptUserFunction = options =>
            {
                _promptUserOptions.Add(options);
                return(_promptUserReturnValue);
            };
        }
Example #4
0
        public void TestShouldAddProjectItemGlobal2017()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(
                dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2017Version));

            var result = _objectUnderTest.ShouldAddProjectItem(GlobalJsonFileName);

            Assert.IsFalse(result);
        }
 public void BeforeEach()
 {
     _targetSdkVersions = new List <string>();
     VsVersionUtils.s_toolsPathProvider = new Lazy <IToolsPathProvider>(
         () => Mock.Of <IToolsPathProvider>(tpp => tpp.GetNetCoreSdkVersions() == _targetSdkVersions));
     CredentialsStore.Default.UpdateCurrentProject(Mock.Of <Project>(p => p.ProjectId == DefaultProjectId));
     _closeWindowMock = new Mock <Action>();
     GoogleCloudExtensionPackageTests.InitPackageMock(
         dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2017Version));
 }
Example #6
0
        public void TestInitialConditionsVs2015NoNetCoreSdk()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(
                dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2015Version));

            _objectUnderTest = new TemplateChooserViewModel(_closeWindowMock.Object, _promptPickProjectMock.Object);

            Assert.IsFalse(_objectUnderTest.NetCoreAvailable);
            Assert.AreEqual(FrameworkType.NetFramework, _objectUnderTest.SelectedFramework);
            CollectionAssert.AreEqual(
                new[] { AspNetVersion.AspNet4 }, _objectUnderTest.AvailableVersions.ToList());
            Assert.AreEqual(AspNetVersion.AspNet4, _objectUnderTest.SelectedVersion);
        }
        public void TestInitialConditionsVs2015()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(
                dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2015Version));
            _targetSdkVersions.Add("1.0.0-preview2-003156");

            var objectUnderTest = new AspNetCoreTemplateChooserViewModel(_closeWindowMock.Object);

            CollectionAssert.AreEqual(new[] { FrameworkType.NetCore, FrameworkType.NetFramework }, objectUnderTest.AvailableFrameworks.ToList());
            Assert.AreEqual(FrameworkType.NetCore, objectUnderTest.SelectedFramework);
            CollectionAssert.AreEqual(
                new[] { AspNetVersion.AspNetCore1Preview }, objectUnderTest.AvailableVersions.ToList());
            Assert.AreEqual(AspNetVersion.AspNetCore1Preview, objectUnderTest.SelectedVersion);
        }
        public void TestInitialConditionsMissingNetCoreSdk()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(
                dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2015Version));

            var objectUnderTest = new AspNetCoreTemplateChooserViewModel(_closeWindowMock.Object);

            CollectionAssert.AreEqual(new[] { FrameworkType.NetFramework }, objectUnderTest.AvailableFrameworks.ToList());
            Assert.AreEqual(FrameworkType.NetFramework, objectUnderTest.SelectedFramework);
            CollectionAssert.AreEqual(
                new[] { AspNetVersion.AspNetCore10, AspNetVersion.AspNetCore11, AspNetVersion.AspNetCore20 },
                objectUnderTest.AvailableVersions.ToList());
            Assert.AreEqual(AspNetVersion.AspNetCore10, objectUnderTest.SelectedVersion);
        }
Example #9
0
        public void TestInitialConditionsVs2017WithBothNetCoreSdk10And20()
        {
            GoogleCloudExtensionPackageTests.InitPackageMock(
                dteMock => dteMock.Setup(dte => dte.Version).Returns(VsVersionUtils.VisualStudio2017Version));
            _targetSdkVersions.Add("2.0.0");
            _targetSdkVersions.Add("1.0.0");

            _objectUnderTest = new TemplateChooserViewModel(_closeWindowMock.Object, _promptPickProjectMock.Object);

            Assert.IsTrue(_objectUnderTest.NetCoreAvailable);
            Assert.AreEqual(FrameworkType.NetCore, _objectUnderTest.SelectedFramework);
            CollectionAssert.AreEqual(
                new[] { AspNetVersion.AspNetCore10, AspNetVersion.AspNetCore11, AspNetVersion.AspNetCore20 },
                _objectUnderTest.AvailableVersions.ToList());
            Assert.AreEqual(AspNetVersion.AspNetCore10, _objectUnderTest.SelectedVersion);
        }
        public void BeforeEach()
        {
            _settingManagerMock = new Mock <IVsSettingsManager>();
            _uiShellMock        = new Mock <IVsUIShell>();
            int intValue           = 0;
            IVsSettingsStore store = Mock.Of <IVsSettingsStore>(
                ss => ss.GetIntOrDefault(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), out intValue) == 0);

            _settingManagerMock.Setup(sm => sm.GetReadOnlySettingsStore(It.IsAny <uint>(), out store)).Returns(0);
            GoogleCloudExtensionPackageTests.InitPackageMock(dte =>
            {
                Mock <IServiceProvider> providerMock = dte.As <IServiceProvider>();
                GoogleCloudExtensionPackageTests.SetupService <SVsSettingsManager, IVsSettingsManager>(
                    providerMock, _settingManagerMock);
                GoogleCloudExtensionPackageTests.SetupService <IVsUIShell, IVsUIShell>(providerMock, _uiShellMock);
            });
        }
 public void BeforeEach()
 {
     GoogleCloudExtensionPackageTests.InitPackageMock(dte => { });
 }