forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SignatureFixture.cs
41 lines (38 loc) · 1.5 KB
/
SignatureFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;
namespace LibGit2Sharp.Tests
{
public class SignatureFixture : BaseFixture
{
[Theory]
[InlineData("\0Leading zero")]
[InlineData("Trailing zero\0")]
[InlineData("Zero \0inside")]
[InlineData("\0")]
[InlineData("\0\0\0")]
public void CreatingASignatureWithANameContainingZerosThrows(string name)
{
Assert.Throws<ArgumentException>(() => new Signature(name, "[email protected]", DateTimeOffset.Now));
}
[Theory]
[InlineData("\[email protected]")]
[InlineData("[email protected]\0")]
[InlineData("Zero@\0inside.com")]
[InlineData("\0")]
[InlineData("\0\0\0")]
public void CreatingASignatureWithAnEmailContainingZerosThrows(string email)
{
Assert.Throws<ArgumentException>(() => new Signature("Me", email, DateTimeOffset.Now));
}
[Fact]
public void CreatingASignatureWithBadParamsThrows()
{
Assert.Throws<ArgumentNullException>(() => new Signature(null, "[email protected]", DateTimeOffset.Now));
Assert.Throws<ArgumentException>(() => new Signature(string.Empty, "[email protected]", DateTimeOffset.Now));
Assert.Throws<ArgumentNullException>(() => new Signature("Me", null, DateTimeOffset.Now));
Assert.Throws<ArgumentException>(() => new Signature("Me", string.Empty, DateTimeOffset.Now));
}
}
}