This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.EntityFrameworkCore.Query.Internal; | |
namespace Application | |
{ | |
internal class TestAsyncQueryProvider<TEntity> : IAsyncQueryProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DbSetMockHelper | |
{ | |
public static DbSet<TEntity> CreateMock<TEntity,TContext>(List<TEntity> entities, out TContext context) where TEntity : class where TContext: class | |
{ | |
IQueryable<TEntity> data = entities.AsQueryable(); | |
DbSet<TEntity> mockSet = A.Fake<DbSet<TEntity>>(d => d.Implements<IQueryable<TEntity>>().Implements<IAsyncEnumerable<TEntity>>()); | |
A.CallTo(() => ((IAsyncEnumerable<TEntity>)mockSet).GetEnumerator()) | |
.Returns(new TestAsyncEnumerator<TEntity>(data.GetEnumerator())); | |
A.CallTo(() => ((IQueryable<TEntity>)mockSet).Provider).Returns(new TestAsyncQueryProvider<TEntity>(data.Provider)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class AsyncQueryTests | |
{ | |
[Test] | |
public async Task GetAllBlogsAsync_orders_by_name() | |
{ | |
var data = new List<Blog> | |
{ | |
new Blog { Name = "BBB" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/p:Configuration=Release | |
/p:OutputPath=bin | |
/p:DeployOnBuild=True | |
/p:DeployTarget=MSDeployPublish | |
/p:MsDeployServiceUrl=YOUR_PROJECT.scm.azure-mobile.net:443 | |
/p:username="%deployUser%" | |
/p:password=%deployPassword% | |
/p:AllowUntrustedCertificate=True | |
/p:DeployIisAppPath=YOUR_PROJECT_WEBSITE | |
/p:MSDeployPublishMethod=WMSVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/p:Configuration=Release | |
/p:OutputPath=bin | |
/p:DeployOnBuild=True | |
/p:DeployTarget=MSDeployPublish | |
/p:MsDeployServiceUrl=YOUR_PROJECT.scm.azure-mobile.net:443 | |
/p:username="$USERNAME" | |
/p:password="A_VERY_LONG_PASSWORD" | |
/p:AllowUntrustedCertificate=True | |
/p:DeployIisAppPath=YOUR_PROJECT_WEBSITE | |
/p:MSDeployPublishMethod=WMSVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/p:Configuration=Release | |
/p:OutputPath=bin | |
/p:DeployOnBuild=True | |
/p:DeployTarget=MSDeployPublish | |
/p:MsDeployServiceUrl=YOUR_PROJECT.scm.azure-mobile.net:443 | |
/p:username="$USERNAME" | |
/p:password=%A_VERY_LONG_PASSWORD% | |
/p:AllowUntrustedCertificate=True | |
/p:DeployIisAppPath=YOUR_PROJECT_WEBSITE | |
/p:MSDeployPublishMethod=WMSVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace LuceneWrapper.TestApp | |
{ | |
public class PersonSearcher:BaseSearcher | |
{ | |
public PersonSearcher(string dataFolder) : base(dataFolder) | |
{ | |
} | |
public SearchResult SearchPeople(string searchTerm, string field) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
namespace LuceneWrapper.TestApp | |
{ | |
public class PersonWriter : BaseWriter | |
{ | |
public PersonWriter(string dataFolder) | |
: base(dataFolder) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace LuceneWrapper.TestApp | |
{ | |
public class Person | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace LuceneWrapper.TestApp | |
{ | |
public class Program | |
{ | |
private static List<Person> people; |
NewerOlder