async Task Create(string theBoxId) { #region NewtonsoftCreate var box = new NewtonsoftJsonBox( httpClient, theBoxId, serializer); var person = new Person { Age = 10, Name = "Lesle" }; await box.CreateAsync(person); #endregion }
public async Task CollectionNameTooLong() { var mockHttp = new MockHttpMessageHandler(); var jsonBox = new NewtonsoftJsonBox(mockHttp.ToHttpClient(), "testbox___jsonboxnet", new JsonSerializer()); var fixture = new Fixture(); var item = fixture.Create <TestObject>(); await jsonBox.Invoking(async jb => await jsonBox.CreateAsync("collection_collection", item)) .Should().ThrowAsync <ArgumentException>(); await jsonBox.Invoking(async jb => await jsonBox.CreateManyAsync("collection_collection", item)) .Should().ThrowAsync <ArgumentException>(); await jsonBox.Invoking(async jb => await jsonBox.CreateManyAsync("collection_collection", new List <TestObject> { item })) .Should().ThrowAsync <ArgumentException>(); }