private static ObservableUserEmailsClient CreateFixtureWithNonReactiveClient()
 {
     var nonreactiveClient = new UserEmailsClient(Substitute.For<IApiConnection>());
     var github = Substitute.For<IGitHubClient>();
     github.User.Email.Returns(nonreactiveClient);
     return new ObservableUserEmailsClient(github);
 }
Ejemplo n.º 2
0
        private static ObservableUserEmailsClient CreateFixtureWithNonReactiveClient()
        {
            var nonreactiveClient = new UserEmailsClient(Substitute.For <IApiConnection>());
            var github            = Substitute.For <IGitHubClient>();

            github.User.Email.Returns(nonreactiveClient);
            return(new ObservableUserEmailsClient(github));
        }
            public void PostsToCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserEmailsClient(connection);

                client.Delete("*****@*****.**");

                connection.Received(1)
                .Delete(Arg.Is <Uri>(u => u.ToString() == "user/emails"), Arg.Any <string[]>());
            }
            public void GetsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserEmailsClient(connection);

                client.GetAll();

                connection.Received(1)
                .GetAll <EmailAddress>(Arg.Is <Uri>(u => u.ToString() == "user/emails"));
            }
            public void PostsToCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserEmailsClient(connection);

                client.Delete("*****@*****.**");

                connection.Received(1)
                    .Delete(Arg.Is<Uri>(u => u.ToString() == "user/emails"), Arg.Any<string[]>());
            }
            public void GetsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserEmailsClient(connection);

                client.GetAll();

                connection.Received(1)
                    .GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"));
            }
            public void RequestsCorrectUrlWithApiOptions()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new UserEmailsClient(connection);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    PageSize  = 1,
                    StartPage = 1
                };

                client.GetAll(options);

                connection.Received(1)
                .GetAll <EmailAddress>(Arg.Is <Uri>(u => u.ToString() == "user/emails"),
                                       options);
            }
            public void RequestsCorrectUrlWithApiOptions()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new UserEmailsClient(connection);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    PageSize = 1,
                    StartPage = 1
                };

                client.GetAll(options);

                connection.Received(1)
                    .GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"),
                        options);
            }
 public async Task EnsuresNonNullArgument()
 {
     var client = new UserEmailsClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentNullException>(() => client.Delete(null));
 }
 public async Task EnsuresNoNullEmails()
 {
     var client = new UserEmailsClient(Substitute.For <IApiConnection>());
     await Assert.ThrowsAsync <ArgumentException>(() => client.Add("*****@*****.**", null));
 }
Ejemplo n.º 11
0
            public void EnsuresNoNullEmails()
            {
                var client = new UserEmailsClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentException>(() => client.Delete("*****@*****.**", null));
            }
Ejemplo n.º 12
0
            public void EnsuresNonNullArgument()
            {
                var client = new UserEmailsClient(Substitute.For <IApiConnection>());

                Assert.Throws <ArgumentNullException>(() => client.Delete(null));
            }
 public async Task EnsuresNoNullEmails()
 {
     var client = new UserEmailsClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("*****@*****.**", null));
 }
 public async Task EnsuresNonNullArgument()
 {
     var client = new UserEmailsClient(Substitute.For<IApiConnection>());
     await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete(null));
 }
Ejemplo n.º 15
0
 public void EnsuresNonNullArgument()
 {
     var client = new UserEmailsClient(Substitute.For<IApiConnection>());
     Assert.Throws<ArgumentNullException>(() => client.Delete(null));
 }
Ejemplo n.º 16
0
 public void EnsuresNoNullEmails()
 {
     var client = new UserEmailsClient(Substitute.For<IApiConnection>());
     Assert.Throws<ArgumentException>(() => client.Add("*****@*****.**", null));
 }