public async Task Create_Single_ReturnSingle() { var col = Substitute.For<IMongoCollection<DataExample>>(); var data = new DataExample() { A = 0, B = 1 }; var result = await col.Create(data).PushAsync(); #pragma warning disable 4014 col.Received().InsertOneAsync(data, default(CancellationToken)); #pragma warning restore 4014 data.ShouldBe(result); }
public async Task Create_ManyItems_ReturnMany() { var col = Substitute.For<IMongoCollection<DataExample>>(); var data = new DataExample() { A = 0, B = 1 }; var manyData = new[] {data, data}; var result = await col.Create(manyData) .PushAsync(); #pragma warning disable 4014 col.Received().InsertManyAsync(Arg.Any<IEnumerable<DataExample>>(), null, default(CancellationToken)); #pragma warning restore 4014 result.ShouldBe(manyData); }