public async Task Should_Run_CallbackAsync() { var result = await unitOfWork.WithTransactionAsync((s, ct) => Task.FromResult(true), cancellationToken); Assert.True(result); await mongoClient.Received().StartSessionAsync(); await clientSessionHandle.Received().WithTransactionAsync(Arg.Any <Func <IClientSessionHandle, CancellationToken, Task <bool> > >(), transactionOptions, cancellationToken); }
public void Constructor_GetsDatabase_And_StartsSession() { //Arrange //Act //Assert clientFactory.Received(1).CreateClient(Arg.Is(configuration)); client.Received(1).GetDatabase(Arg.Is(MongoDbWriteModelUnitOfWork.databaseName)); client.Received(1).StartSession(); }