コード例 #1
0
            public void PostsToTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PersonsClient(connection);

                var newPerson = new NewPerson("name");

                client.Create(newPerson);

                connection.Received().Post <Person>(Arg.Is <Uri>(u => u.ToString() == "persons"),
                                                    Arg.Is <NewPerson>(d => d.Name == "name"));
            }
コード例 #2
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new PersonsClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null));
            }