/Mercurial.Net.Tests/AdditionalArgumentsTests.cs
C# | 46 lines | 40 code | 6 blank | 0 comment | 0 complexity | 7ef8fec8bdbcb6f290e772c24f13d149 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
- using System;
- using System.Globalization;
- using NUnit.Framework;
-
- namespace Mercurial.Tests
- {
- [TestFixture]
- [Category("Integration")]
- public class AdditionalArgumentsTests : SingleRepositoryTestsBase
- {
- [Test]
- public void Log_WithUnknownArgument_ThrowsMercurialExecutionException()
- {
- Repo.Init();
-
- var command = new LogCommand();
- command.AdditionalArguments.Add("--dummyargument");
-
- Assert.Throws<MercurialExecutionException>(() => Repo.Execute(command));
- }
-
- [Test]
- public void Log_WithUnknownArgument_ThrowsMercurialExecutionExceptionThatMentionesArgument()
- {
- Repo.Init();
-
- var command = new LogCommand();
- command.AdditionalArguments.Add("--dummyargument");
-
- try
- {
- Repo.Execute(command);
- }
- catch (MercurialExecutionException ex)
- {
- Assert.That(ex.Message, Is.StringContaining("hg log: option --dummyargument not recognized"));
- return;
- }
- catch (Exception ex)
- {
- Assert.Fail(string.Format(CultureInfo.InvariantCulture, "Log with unknown argument should not have thrown {0}", ex.GetType().Name));
- }
- Assert.Fail("Log with unknown argument should have thrown MercurialExecutionException");
- }
- }
- }