Skip to content

Instantly share code, notes, and snippets.

Bart De Meyer BartDM

View GitHub Profile
View DbSetMockHelper.cs
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));
View AsyncQueryTests.cs
[TestFixture]
public class AsyncQueryTests
{
[Test]
public async Task GetAllBlogsAsync_orders_by_name()
{
var data = new List<Blog>
{
new Blog { Name = "BBB" },
View TestAsyncQueryProvider.cs
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
View gist:fc8ab67af601ccdeea03a32cda52ed71
/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
View gist:e94720cfdf8fe8cf40290365988a459f
/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
View gist:3114c3dcbd37473cdf693da21cc23ac1
/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
View gist:30f1f8ca9dec4fbe8e87
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("")]
View gist:390ade7e31e4ae46a4c8
public IEnumerable<IDestination> Destinations()
{
yield return new DemoDestination(this);
}
View gist:efe52046371f45f6503e
using System;
using System.IO;
using System.Windows.Forms;
using Greenshot.IniFile;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
namespace GreenshotDemoPlugin
{
View gist:ae96061f43635e2c541f
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));
You can’t perform that action at this time.