public async Task Create_method_should_call_mongoClient_in_order_to_StartSession(bool useOptions)
        {
            //arrange
            var options    = useOptions ? new ClientSessionOptions() : null;
            var clientMock = new Mock <IMongoClient>();

            clientMock.Setup(c => c.StartSessionAsync(options, It.IsAny <CancellationToken>()))
            .ReturnsAsync(() => new FakeMongoDbClientSession())
            .Verifiable("The StartSessionAsync wasn't called");

            _sut = new MongoDbSessionFactory(clientMock.Object);

            //act
            var session = await(options is null ? _sut.Create() : _sut.Create(options));

            //assert
            session.Should().NotBeNull("Factory should create new instance");
            clientMock.Verify(c => c.StartSessionAsync(options, It.IsAny <CancellationToken>()), Times.Once);
        }
 public MongoDbUnitOfWorkFactory(IMongoDbSessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
 }
 public void TearDown() => _sut = null;