Skip to content

Instantly share code, notes, and snippets.

View BartDM's full-sized avatar

Bart De Meyer BartDM

View GitHub Profile
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));
[TestFixture]
public class AsyncQueryTests
{
[Test]
public async Task GetAllBlogsAsync_orders_by_name()
{
var data = new List<Blog>
{
new Blog { Name = "BBB" },
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
/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
/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
/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
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using Greenshot.Plugin;
[assembly: AssemblyTitle("GreenshotDemoPlugin")]
[assembly: AssemblyDescription("")]
public IEnumerable<IDestination> Destinations()
{
yield return new DemoDestination(this);
}
using System;
using System.IO;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
namespace GreenshotDemoPlugin
{
using System;
using System.Collections.Generic;
using Greenshot.IniFile;
using Greenshot.Plugin;
namespace GreenshotDemoPlugin
{
public class DemoPlugin: IGreenshotPlugin
{
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(DemoPlugin));