public async Task GetDetailsOfUserById_GivenMoreThenOneRecordIsFound_ExpectMaybeWithNothing() { var currentAuthenticatedUserProvider = new Mock <ICurrentAuthenticatedUserProvider>(); var connection = new Mock <IDbConnection>(); connection.SetupDapperAsync(c => c.QueryAsync <DetailedUserDto>( It.IsAny <string>(), It.IsAny <DynamicParameters>(), null, null, It.IsAny <CommandType>())) .ReturnsAsync(() => new List <DetailedUserDto> { new DetailedUserDto(), new DetailedUserDto(), }); var dbConnectionProvider = new Mock <IConnectionProvider>(); dbConnectionProvider.Setup(x => x.GetConnection()) .Returns(() => connection.Object); var userQueries = new UserQueries(currentAuthenticatedUserProvider.Object, dbConnectionProvider.Object); var result = await userQueries.GetDetailsOfUserById(Guid.NewGuid()); Assert.True(result.HasNoValue); }