示例#1
0
            public void CallsCheckAssigneeOnClient()
            {
                var github = Substitute.For <IGitHubClient>();
                var client = new ObservableAssigneesClient(github);

                client.CheckAssignee(owner, name, assignee);

                github.Issue.Assignee.Received(1).CheckAssignee(Arg.Is(owner), Arg.Is(name), Arg.Is(assignee));
            }
            public void CallsCheckAssigneeOnClientWithRepositoryId()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableAssigneesClient(gitHubClient);

                client.CheckAssignee(repositoryId, assignee);

                gitHubClient.Issue.Assignee.Received(1).CheckAssignee(repositoryId, assignee);
            }
            public void EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For <IGitHubClient>();
                var client       = new ObservableAssigneesClient(gitHubClient);

                Assert.Throws <ArgumentNullException>(() => client.CheckAssignee(null, name, assignee));
                Assert.Throws <ArgumentNullException>(() => client.CheckAssignee(owner, null, assignee));
                Assert.Throws <ArgumentNullException>(() => client.CheckAssignee(owner, name, null));

                Assert.Throws <ArgumentNullException>(() => client.CheckAssignee(1, null));

                Assert.Throws <ArgumentException>(() => client.CheckAssignee(string.Empty, name, assignee));
                Assert.Throws <ArgumentException>(() => client.CheckAssignee(owner, string.Empty, assignee));
                Assert.Throws <ArgumentException>(() => client.CheckAssignee(owner, name, string.Empty));

                Assert.Throws <ArgumentException>(() => client.CheckAssignee(1, string.Empty));
            }