NUnit.Framework.Assert.IsNotNullOrEmpty(string)

Here are the examples of the csharp api class NUnit.Framework.Assert.IsNotNullOrEmpty(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

129 Examples 7

1. Example

View license
[Test]
        public void GetUserDataFolderReturnsString()
        {
            // Given

            // When
            string userDataFolder = InternalsHelper.GetUserDataFolder();

            // Then
            Assert.IsNotNullOrEmpty(userDataFolder);
        }

2. Example

View license
[Test]
        public void Should_Return_AllModules_StyleSheets_Successfully()
        {
            var request = new GetStyleSheetsToRenderRequest
                              {
                                  RenderPrivateCssIncludes = true,
                                  RenderPublicCssIncludes = true,
                                  ModuleDescriptorType = null
                              };

            var command = new GetStyleSheetsToRenderCommand(Container.Resolve<IRenderingService>());
            var model = command.Execute(request);

            var css = model.StyleSheetFiles.FirstOrDefault(ss => ss.EndsWith(RootMinCss, System.StringComparison.Ordinal));
            Assert.IsNotNullOrEmpty(css);

            css = model.StyleSheetFiles.FirstOrDefault(ss => ss.EndsWith(PagesMinCss, System.StringComparison.Ordinal));
            Assert.IsNotNullOrEmpty(css);
        }

3. Example

Project: sharpshell
Source File: ShellInteropTests.cs
View license
[Test]
        public void CanGetKnownFolderPath()
        {
            //  We must be able to get the documents known path without throwing an exception.
            string path;
            Shell32.SHGetKnownFolderPath(KnownFolders.FOLDERID_Documents, KNOWN_FOLDER_FLAG.KF_NO_FLAGS, IntPtr.Zero, out path);
            Assert.IsNotNullOrEmpty(path);
        }

4. Example

View license
[Test]
        public void Generic_Setup_Help_And_Ensure_It_Can_Be_Called_Manually()
        {
            var parser = new FluentCommandLineParser<TestApplicationArgs>();

            string callbackResult = null;

            parser.SetupHelp("?").Callback(s => callbackResult = s);

            parser.HelpOption.ShowHelp(parser.Options);

            Assert.IsNotNullOrEmpty(callbackResult);           
        }

5. Example

Project: Glob.cs
Source File: Tests.cs
View license
[Test]
        public void CanLog()
        {
            var log = "";
            var glob = new Glob(TestDir + @"\>") { IgnoreCase = true, ErrorLog = s => log += s };
            var fs = glob.ExpandNames().ToList();
            Assert.IsNotNullOrEmpty(log);
        }

6. Example

Project: RollbarSharp
Source File: RollbarClientTest.cs
View license
[Test]
        public void when_serializing_message_notice_result_should_not_be_empty()
        {
            var client = new RollbarClient();
            var notice = client.NoticeBuilder.CreateMessageNotice("Hello");

            notice.Server.Host = "miker";
            notice.Request.Url = "http://localhost/hej";
            notice.Request.Method = "GET";

            var serialized = client.Serialize(notice);

            Assert.IsNotNullOrEmpty(serialized);
        }

7. Example

Project: RollbarSharp
Source File: RollbarClientTest.cs
View license
[Test]
        public void when_serializing_exception_notice_result_should_not_be_empty()
        {
            var client = new RollbarClient();
            Exception exception = new NotImplementedException();

            var notice = client.NoticeBuilder.CreateExceptionNotice(exception);
            notice.Server.Host = "miker";
            notice.Request.Url = "http://localhost/hej";
            notice.Request.Method = "GET";
            notice.Request.Headers.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31");
            notice.Request.UserIp = "67.90.39.34";
            notice.Person.Id = "123";
            notice.Person.Username = Environment.UserName;

            var serialized = client.Serialize(notice);

            Assert.IsNotNullOrEmpty(serialized);
        }

8. Example

Project: RollbarSharp
Source File: NotifierModelTest.cs
View license
[Test]
        public void when_creating_notifier_from_assembly_info_should_have_Version_populated()
        {
            Assert.IsNotNullOrEmpty(model.Version);
        }

9. Example

Project: pagarme-net
Source File: CreditCardTests.cs
View license
[Test]
        public void CreateHash()
        {
            Assert.IsNotNullOrEmpty(GetCardHash());
        }

10. Example

Project: PDFCreator
Source File: DropboxServiceTest.cs
View license
[Test]
        public void Check_AuthorisationUriCreated_RetursnNonEmptyString()
        {
            var result = _dropboxService.GetAuthorizeUri(APP_KEY, REDIRECT_URI);
            // check is authentication url starts with redirecturi. if not test is failed.
            Assert.IsNotNullOrEmpty(result.AbsoluteUri);
        }

11. Example

Project: PDFCreator
Source File: DropboxServiceTest.cs
View license
[Test]
        public void GetDropboxUserAccountId()
        {
            Assert.IsNotNullOrEmpty(_dropboxService.GetDropUserInfo(DROPBOX_ACCESSTOKEN).AccountId);
        }

12. Example

Project: PDFCreator
Source File: DropboxServiceTest.cs
View license
[Test]
        public void SetUserInfoAndCheckAccountInfo_ReturnsNonEmptyString()
        {
            Assert.IsNotNullOrEmpty(_dropboxService.GetDropUserInfo(DROPBOX_ACCESSTOKEN).AccountId);
        }

13. Example

Project: discutils
Source File: ElementValueTest.cs
View license
[Test]
        public void IntegerListValue()
        {
            RegistryHive hive = RegistryHive.Create(new MemoryStream());
            Store s = Store.Initialize(hive.Root);
            BcdObject obj = s.CreateInherit(InheritType.AnyObject);

            Element el = obj.AddElement(WellKnownElement.LibraryBadMemoryList, ElementValue.ForIntegerList(new long[] { 1234, 4132 }));

            el = obj.GetElement(WellKnownElement.LibraryBadMemoryList);

            Assert.IsNotNullOrEmpty(el.Value.ToString());
        }

14. Example

Project: discutils
Source File: ElementValueTest.cs
View license
[Test]
        public void DeviceValue_BootDevice()
        {
            RegistryHive hive = RegistryHive.Create(new MemoryStream());
            Store s = Store.Initialize(hive.Root);
            BcdObject obj = s.CreateInherit(InheritType.AnyObject);

            Element el = obj.AddElement(WellKnownElement.LibraryApplicationDevice, ElementValue.ForBootDevice());

            el = obj.GetElement(WellKnownElement.LibraryApplicationDevice);

            Assert.IsNotNullOrEmpty(el.Value.ToString());
        }

15. Example

Project: discutils
Source File: ElementValueTest.cs
View license
[Test]
        public void DeviceValue_Mbr()
        {
            SparseMemoryStream ms = new SparseMemoryStream();
            ms.SetLength(80 * 1024 * 1024);
            BiosPartitionTable pt = BiosPartitionTable.Initialize(ms, Geometry.FromCapacity(ms.Length));
            pt.Create(WellKnownPartitionType.WindowsNtfs, true);
            VolumeManager volMgr = new VolumeManager(ms);

            RegistryHive hive = RegistryHive.Create(new MemoryStream());
            Store s = Store.Initialize(hive.Root);
            BcdObject obj = s.CreateInherit(InheritType.AnyObject);

            Element el = obj.AddElement(WellKnownElement.LibraryApplicationDevice, ElementValue.ForDevice(Guid.Empty, volMgr.GetPhysicalVolumes()[0]));

            el = obj.GetElement(WellKnownElement.LibraryApplicationDevice);

            Assert.IsNotNullOrEmpty(el.Value.ToString());
        }

16. Example

Project: discutils
Source File: ElementValueTest.cs
View license
[Test]
        public void DeviceValue_Gpt()
        {
            SparseMemoryStream ms = new SparseMemoryStream();
            ms.SetLength(80 * 1024 * 1024);
            GuidPartitionTable gpt = GuidPartitionTable.Initialize(ms, Geometry.FromCapacity(ms.Length));
            gpt.Create(WellKnownPartitionType.WindowsNtfs, true);
            VolumeManager volMgr = new VolumeManager(ms);

            RegistryHive hive = RegistryHive.Create(new MemoryStream());
            Store s = Store.Initialize(hive.Root);
            BcdObject obj = s.CreateInherit(InheritType.AnyObject);

            Element el = obj.AddElement(WellKnownElement.LibraryApplicationDevice, ElementValue.ForDevice(Guid.Empty, volMgr.GetPhysicalVolumes()[0]));

            el = obj.GetElement(WellKnownElement.LibraryApplicationDevice);

            Assert.IsNotNullOrEmpty(el.Value.ToString());
        }

17. Example

Project: rmb_converter
Source File: RmbUpperTests.cs
View license
[Test]
        public void TestRandomly([Random(0.00, 99999999999.99, 5)] double price) {
            var d = new decimal(price);
            Assert.IsNotNullOrEmpty(d.ToRmbUpper());
        }

18. Example

View license
[TestCase("azzlack", "aabbccddee")]
        public async void Authenticate_WhenGivenOpenIdScopeAndValidRefreshToken_ShouldReturnIdToken(string userName, string password)
        {
            var token = await this.client.Authenticate(userName, password, new[] { "openid" });

            var newToken = await this.client.RefreshAuthentication(token.RefreshToken);

            Assert.IsNotNullOrEmpty(newToken.IdToken, "The token endpoint did not return an ID token");
        }

19. Example

Project: WowPacketParser
Source File: StatisticsTest.cs
View license
[Test]
        public void TestToString()
        {
            // What is there to test?

            var stats = new Statistics(6);
            stats.AddSuccess();
            stats.AddSuccess();
            stats.AddSuccess();
            stats.AddWithErrors();
            stats.AddWithErrors();
            stats.AddNotParsed();
            stats.AddNoStructure();

            var str = stats.ToString();

            Assert.IsNotNullOrEmpty(str);
        }

20. Example

Project: Prig
Source File: ConsoleViewModelTest.cs
View license
[Test]
        public void ShowSkippedMachineWideProcessMessage_should_show_the_message(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc,
            [Values(SkippedReasons.AlreadyRegistered, SkippedReasons.Error)]
            SkippedReasons reason)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new ConsoleViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ShowSkippedMachineWideProcessMessage(reason);


            // Assert
            Assert.IsNotNullOrEmpty(vm.Message.Value);
        }

21. Example

Project: Prig
Source File: ConsoleViewModelTest.cs
View license
[Test]
        public void ReportEnvironmentVariableProcessedProgress_should_report_the_progress(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new ConsoleViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportEnvironmentVariableProcessedProgress();


            // Assert
            Assert.IsNotNullOrEmpty(vm.Message.Value);
        }

22. Example

Project: Prig
Source File: ConsoleViewModelTest.cs
View license
[Test]
        public void ShowCurrentConsoleHasNotBeenElevatedYetMessage_should_show_the_message()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new ConsoleViewModel();

            // Act
            vm.ShowCurrentConsoleHasNotBeenElevatedYetMessage();


            // Assert
            Assert.IsNotNullOrEmpty(vm.Message.Value);
        }

23. Example

Project: CIAPI.CS
Source File: NewsFixture.cs
View license
[Test]
        public void HowToUseNews()
        {
            var rpcClient = BuildRpcClient("HowToUseNews");




            // get some headlines
            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);

            // get a story id from one of the headlines
            var storyId = headlines.Headlines[0].StoryId;

            // get the body of the story
            // the api team has yet again broken an established and published interface with yet another
            // half baked change. if you are going to require a key to retrieve detail you need to provide
            // the key on the master. again, the client is required to maintain corellation information (i.e. market type)
            // not impressed.
            var storyDetail = rpcClient.News.GetNewsDetail("dj", storyId.ToString());

            Assert.IsNotNullOrEmpty(storyDetail.NewsDetail.Story, "story was empty?");


            rpcClient.LogOut();
            rpcClient.Dispose();
        }

24. Example

Project: CIAPI.CS
Source File: NewsFixture.cs
View license
[Test]
        public void CanListNewsHeadlinesWithSource()
        {
            var rpcClient = BuildRpcClient("CanListNewsHeadlinesWithSource");




            // get some headlines
            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);

            // get a story id from one of the headlines
            var storyId = headlines.Headlines[0].StoryId;

            // get the body of the story
            var storyDetail = rpcClient.News.GetNewsDetail("dj", storyId.ToString());


            Assert.IsNotNullOrEmpty(storyDetail.NewsDetail.Story, "story was empty?");


            rpcClient.LogOut();
            rpcClient.Dispose();
        }

25. Example

Project: CIAPI.CS
Source File: NewsFixture.cs
View license
[Test]
        public void CanListNewsHeadlinesWithSource()
        {
            var rpcClient = BuildRpcClient();




            // get some headlines
            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);

            // get a story id from one of the headlines
            var storyId = headlines.Headlines[0].StoryId;

            // get the body of the story
            var storyDetail = rpcClient.News.GetNewsDetail("dj", storyId.ToString());


            Assert.IsNotNullOrEmpty(storyDetail.NewsDetail.Story, "story was empty?");


            rpcClient.LogOut();
            rpcClient.Dispose();
        }

26. Example

Project: CIAPI.CS
Source File: NewsFixture.cs
View license
[Test]
        public void HowToUseNews()
        {
            var rpcClient = BuildRpcClient();




            // get some headlines
            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);

            // get a story id from one of the headlines
            var storyId = headlines.Headlines[0].StoryId;

            // get the body of the story
            // the api team has yet again broken an established and published interface with yet another
            // half baked change. if you are going to require a key to retrieve detail you need to provide
            // the key on the master. again, the client is required to maintain corellation information (i.e. market type)
            // not impressed.
            var storyDetail = rpcClient.News.GetNewsDetail("dj", storyId.ToString());

            Assert.IsNotNullOrEmpty(storyDetail.NewsDetail.Story, "story was empty?");


            rpcClient.LogOut();
            rpcClient.Dispose();
        }

27. Example

View license
[Test]
        public void CanLogin()
        {
    
            var server = new TestServer(true);
/n ..... /n //View Source file for more details /n }

28. Example

View license
[Test]
        public void Should_Return_RootModule_StyleSheets_Successfully()
        {
            var request = new GetStyleSheetsToRenderRequest
            {
                RenderPrivateCssIncludes = true,
                RenderPublicCssIncludes = true,
                ModuleDescriptorType = typeof(RootModuleDescriptor)
            };

            var command = new GetStyleSheetsToRenderCommand(Container.Resolve<IRenderingService>());
            var model = command.Execute(request);

            var css = model.StyleSheetFiles.FirstOrDefault(ss => ss.EndsWith(RootMinCss, System.StringComparison.Ordinal));
            Assert.IsNotNullOrEmpty(css);

            css = model.StyleSheetFiles.FirstOrDefault(ss => ss.EndsWith(PagesMinCss, System.StringComparison.Ordinal));
            Assert.IsNull(css);
        }

29. Example

Project: JQSQL
Source File: DataConverter_Tests.cs
View license
[Test]
        public void When_given_expr_refers_dictionary_return_keys_as_columns()
        {
            var searchResult = JSONQuery.GetValue(jsonTestData, "Messages[0]");

            Converter converter = new Converter();
            var data = converter.ConvertToRecord(searchResult);

            Assert.AreEqual(data.Length, 1, "Wrong number of results");
            Assert.AreEqual(data[0].FieldCount, 4, "Wrong field count of result");
            // Validate column names
            Assert.AreEqual(data[0].GetName(0), "Title", "1. field has invalid name");
            Assert.AreEqual(data[0].GetName(1), "To", "2. field has invalid name");
            Assert.AreEqual(data[0].GetName(2), "Sends", "3. field has invalid name");
            Assert.AreEqual(data[0].GetName(3), "Receives", "4. field has invalid name");
            // Validate row values
            Assert.AreEqual(data[0].GetString(0), "Heyy", "Invalid data on 1. field");
            Assert.AreEqual(data[0].GetString(1), "Thelove", "Invalid data on 2. field");
            Assert.IsNotNullOrEmpty(data[0].GetString(2), "Empty data on 3. field");
            Assert.IsNotNullOrEmpty(data[0].GetString(3), "Empty data on 4. field");
        }

30. Example

View license
[Test]
        public void Setup_Help_And_Ensure_It_Can_Be_Called_Manually()
        {
            var parser = CreateFluentParser();

            string callbackResult = null;

            parser.SetupHelp("?").Callback(s => callbackResult = s);

            parser.HelpOption.ShowHelp(parser.Options);

            Assert.IsNotNullOrEmpty(callbackResult);           
        }

31. Example

View license
[Test]
		public void FromWebSafeBase64()
		{
			var registrationData = FidoRegistrationData.FromWebSafeBase64(TestVectors.RegistrationResponseDataBase64);

			Assert.IsNotNull(registrationData.AttestationCertificate);
			Assert.IsNotNullOrEmpty(registrationData.KeyHandle.ToString());
			Assert.IsNotNullOrEmpty(registrationData.Signature.ToString());
			Assert.IsNotNullOrEmpty(registrationData.UserPublicKey.ToString());
		}

32. Example

Project: RollbarSharp
Source File: ExceptionModelTest.cs
View license
[Test]
        public void when_creating_from_thrown_exception_should_have_Message()
        {
            try
            {
                CreateException();
            }
            catch (Exception ex)
            {
                var model = ExceptionModelBuilder.CreateFromException(ex);

                Assert.IsNotNullOrEmpty(model.Message);
            }
        }

33. Example

Project: sc2replay-csharp
Source File: ReplayTests.cs
View license
[Test, TestCaseSource("TestReplays")]
        public void ReplayHasCorrectNumberOfPlayers(string filename)
        {
            Replay replay = Replay.Parse(filename);

            if (replay.TeamSize.Equals("1v1"))
            {
                Assert.That(replay.Players.Length == 2, "Replay didn't have 2 players in a 1v1.");
            }
            else if (replay.TeamSize.Equals("2v2"))
            {
                Assert.That(replay.Players.Length == 4, "Replay didn't have 4 players in a 2v2.");
            }
            else if (replay.TeamSize.Equals("3v3"))
            {
                Assert.That(replay.Players.Length == 6, "Replay didn't have 6 players in a 3v3.");
            }
            else if (replay.TeamSize.Equals("4v4"))
            {
                Assert.That(replay.Players.Length == 8, "Replay didn't have 8 players in a 4v4.");
            }
            
            foreach (var player in replay.Players)
            {
                Assert.IsNotNullOrEmpty(player.Name, "Player had an empty name.");
                Assert.IsNotNullOrEmpty(player.Color, "Player color was missing.");
            }
        }

34. Example

Project: sc2replay-csharp
Source File: ReplayTests.cs
View license
[Test, TestCaseSource("TestReplays")]
        public void ReplayHasValidMapInfo(string filename)
        {
            Replay replay = Replay.Parse(filename);

            Assert.IsNotNullOrEmpty(replay.Map);
            Assert.IsNotNullOrEmpty(replay.MapGateway);
            Assert.IsNotNullOrEmpty(replay.MapPreviewName);
            Assert.That(replay.MapHash != null);
        }

35. Example

View license
[Test]
		[Category("Full ICU")]
		public void GetSortRules_English()
		{
			var locale = new Locale("en-US");

			var tailoredRules = Collator.GetCollationRules(locale);
			var collationRules = Collator.GetCollationRules(locale, UColRuleOption.UCOL_FULL_RULES);

			Assert.IsEmpty(tailoredRules);
			Assert.IsNotNullOrEmpty(collationRules);
		}

36. Example

View license
[Test]
		public void GenerateXHTMLForEntry_SameGramInfoCollapsesOnDemand()
		{
			var defOrGlossNode/n ..... /n //View Source file for more details /n }

37. Example

View license
[TestCase("bgfdskbnfkldnklfde")]
        [TestCase("123456789")]
        public void Encrypt_WhenGivenValidPrincipal_ReturnsEncryptedPrincipal(string key)
        {
            var c1 = new SentinelPrincipal(new SentinelIdentity("Test", new SentinelClaim(JwtClaimType.Name, "azzlack")));

            var r = this.principalProvider.Encrypt(c1, key);

            Console.WriteLine("Encrypted: {0}", r);

            Assert.IsNotNullOrEmpty(r);
        }

38. Example

Project: Sentinel.OAuth
Source File: JsonWebTokenTests.cs
View license
[TestCase("HS256", "NUnit", "https://sentinel.oauth/", 1445850630, 1445854230, "azzlack", "eyJ0eXAiO/n ..... /n //View Source file for more details /n }

39. Example

View license
[TestCase(64, "aabbccddee")]
        [TestCase(48, "123")]
        [TestCase(128, "aabbccddee")]
        public void Create_WhenGivenValidString_ReturnsHash(int saltByteSize, string text)
        {
            var p = new SHA2CryptoProvider(Sentinel.OAuth.Core.Constants.HashAlgorithm.SHA256, saltByteSize);

            var hash = p.CreateHash(text);

            Console.WriteLine("Hash: {0}", hash);

            Assert.IsNotNullOrEmpty(hash);
        }

40. Example

View license
[TestCase("aabbccddee")]
        public void Create_WhenGivenValidString_ReturnsHash(string text)
        {
            var hash = this.provider.CreateHash(text);

            Console.WriteLine("Hash: {0}", hash);

            Assert.IsNotNullOrEmpty(hash);
        }

41. Example

View license
private void CheckIsNotNullAndString(ProgramLocation pl)
        {
            Assert.IsNotNull(pl);
            Assert.IsNotNullOrEmpty(pl.ToString());
        }

42. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ShowCompletedProjectWideProcessMessage_should_report_the_progress_to_statusbar(
            [Values(
                ProjectWideProcesses.PrigAssemblyAdding,
                ProjectWideProcesses.PrigIndirectionSettingsEditing,
                ProjectWideProcesses.PrigAssemblyRemoving,
                ProjectWideProcesses.TestAdapterEnabling,
                ProjectWideProcesses.TestAdapterDisabling)]
            ProjectWideProcesses pwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var include = fixture.Create<string>();

            var vm = new PrigViewModel();
            vm.BeginProjectWideProcessProgress(pwProc);


            // Act
            vm.ShowCompletedProjectWideProcessMessage(include);


            // Assert
            var msgBox = vm.MessageBoxParameter.Value;
            Assert.AreEqual(OLEMSGBUTTON.OLEMSGBUTTON_OK, msgBox.Button);
            Assert.AreEqual(OLEMSGICON.OLEMSGICON_INFO, msgBox.Icon);
            Assert.IsNotNullOrEmpty(msgBox.Text);
        }

43. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ConfirmRestartingVisualStudioToTakeEffect_should_show_the_message_to_message_box(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc,
            [Values(VSConstants.MessageBoxResult.IDYES, VSConstants.MessageBoxResult.IDNO)]
            VSConstants.MessageBoxResult response)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new PrigViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);
            vm.MessageBoxParameter.Subscribe(_ => _.Result = response);

            // Act
            var result = vm.ConfirmRestartingVisualStudioToTakeEffect();

            // Assert
            Assert.AreEqual(response == VSConstants.MessageBoxResult.IDYES, result);
            var msgBox = vm.MessageBoxParameter.Value;
            Assert.AreEqual(OLEMSGBUTTON.OLEMSGBUTTON_YESNO, msgBox.Button);
            Assert.AreEqual(OLEMSGICON.OLEMSGICON_WARNING, msgBox.Icon);
            Assert.IsNotNullOrEmpty(msgBox.Text);
        }

44. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ReportProcessingProjectWideProcessProgress_should_report_the_progress_to_statusbar(
            [Values(
                ProjectWideProcesses.PrigAssemblyAdding,
                ProjectWideProcesses.PrigIndirectionSettingsEditing,
                ProjectWideProcesses.PrigAssemblyRemoving,
                ProjectWideProcesses.TestAdapterEnabling,
                ProjectWideProcesses.TestAdapterDisabling)]
            ProjectWideProcesses pwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var prog = fixture.Create<uint>();
            var include = fixture.Create<string>();

            var vm = new PrigViewModel();
            vm.BeginProjectWideProcessProgress(pwProc);


            // Act
            vm.ReportProcessingProjectWideProcessProgress(prog, include);


            // Assert
            var progState = vm.Statusbar.ProgressState.Value;
            Assert.AreEqual(prog, progState.Value);
            Assert.IsNotNullOrEmpty(progState.Label);
        }

45. Example

Project: Prig
Source File: ConsoleViewModelTest.cs
View license
[Test]
        public void EndSkippedMachineWideProcessProgress_should_report_the_progress(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc,
            [Values(SkippedReasons.AlreadyRegistered, SkippedReasons.Error)]
            SkippedReasons reason)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new ConsoleViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);
            vm.ShowSkippedMachineWideProcessMessage(reason);

            // Act
            vm.EndSkippedMachineWideProcessProgress(reason);


            // Assert
            Assert.IsNotNullOrEmpty(vm.Message.Value);
            Assert.AreEqual(10 + (int)reason, vm.ExitCode.Value);
        }

46. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ReportEnvironmentVariableProcessedProgress_should_report_the_progress_to_statusbar(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var prog = fixture.Create<uint>();

            var vm = new PrigViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportEnvironmentVariableProcessedProgress(prog);


            // Assert
            var progState = vm.Statusbar.ProgressState.Value;
            Assert.AreEqual(prog, progState.Value);
            Assert.IsNotNullOrEmpty(progState.Label);
        }

47. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ShowSkippedProjectWideProcessMessage_should_report_the_progress_to_statusbar(
            [Values(
                ProjectWideProcesses.PrigAssemblyAdding,
                ProjectWideProcesses.PrigIndirectionSettingsEditing,
                ProjectWideProcesses.PrigAssemblyRemoving,
                ProjectWideProcesses.TestAdapterEnabling,
                ProjectWideProcesses.TestAdapterDisabling)]
            ProjectWideProcesses pwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var include = fixture.Create<string>();

            var vm = new PrigViewModel();
            vm.BeginProjectWideProcessProgress(pwProc);


            // Act
            vm.ShowSkippedProjectWideProcessMessage(SkippedReasons.NotRegisteredYet, include);


            // Assert
            var msgBox = vm.MessageBoxParameter.Value;
            Assert.AreEqual(OLEMSGBUTTON.OLEMSGBUTTON_OK, msgBox.Button);
            Assert.AreEqual(OLEMSGICON.OLEMSGICON_WARNING, msgBox.Icon);
            Assert.IsNotNullOrEmpty(msgBox.Text);
        }

48. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ReportPackagePreparingProgress_should_report_the_progress_to_statusbar()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var prog = fixture.Create<uint>();

            var vm = new PrigViewModel();

            // Act
            vm.ReportPackagePreparingProgress(prog);


            // Assert
            var progState = vm.Statusbar.ProgressState.Value;
            Assert.AreEqual(prog, progState.Value);
            Assert.IsNotNullOrEmpty(progState.Label);
        }

49. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ShowVisualStudioHasNotBeenElevatedYetMessage_should_show_the_message_to_message_box()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new PrigViewModel();

            // Act
            vm.ShowVisualStudioHasNotBeenElevatedYetMessage();


            // Assert
            var msgBox = vm.MessageBoxParameter.Value;
            Assert.AreEqual(OLEMSGBUTTON.OLEMSGBUTTON_OK, msgBox.Button);
            Assert.AreEqual(OLEMSGICON.OLEMSGICON_INFO, msgBox.Icon);
            Assert.IsNotNullOrEmpty(msgBox.Text);
        }

50. Example

Project: Prig
Source File: PrigViewModelTest.cs
View license
[Test]
        public void ShowSkippedMachineWideProcessMessage_should_show_the_message_to_message_box(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc,
            [Values(SkippedReasons.AlreadyRegistered, SkippedReasons.CanceledByUser)]
            SkippedReasons reason)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var vm = new PrigViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ShowSkippedMachineWideProcessMessage(reason);


            // Assert
            var msgBox = vm.MessageBoxParameter.Value;
            Assert.AreEqual(OLEMSGBUTTON.OLEMSGBUTTON_OK, msgBox.Button);
            Assert.AreEqual(OLEMSGICON.OLEMSGICON_INFO, msgBox.Icon);
            Assert.IsNotNullOrEmpty(msgBox.Text);
        }