This repository was archived by the owner on Feb 3, 2023. It is now read-only.
forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathSignatureFixture.cs
More file actions
41 lines (38 loc) · 1.5 KB
/
SignatureFixture.cs
File metadata and controls
41 lines (38 loc) · 1.5 KB
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, "me@there.com", DateTimeOffset.Now));
}
[Theory]
[InlineData("\0Leading@zero.com")]
[InlineData("Trailing@zero.com\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, "me@there.com", DateTimeOffset.Now));
Assert.Throws<ArgumentException>(() => new Signature(string.Empty, "me@there.com", DateTimeOffset.Now));
Assert.Throws<ArgumentNullException>(() => new Signature("Me", null, DateTimeOffset.Now));
Assert.Throws<ArgumentException>(() => new Signature("Me", string.Empty, DateTimeOffset.Now));
}
}
}