Skip to content

Instantly share code, notes, and snippets.

View bklooste's full-sized avatar

Ben Kloosterman bklooste

View GitHub Profile
echo "unit tests and coverage" && ls && pwd && dotnet test --filter UnitTest --results-directory /testresults --logger "trx;LogFileName=test_results.xml" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=/testresults/coverage/ /p:Exclude="[xunit.*]*%2c[StackExchange.*]*"
dotnet tool install dotnet-reportgenerator-globaltool --version 4.8.5 --tool-path /tools
/tools/reportgenerator "-reports:/testresults/coverage/coverage.cobertura.xml" "-targetdir:/testresults/coverage/reports" "-reporttypes:HTMLInline;HTMLChart"
ls -la /testresults/coverage/reports
@bklooste
bklooste / CosmosTransactionalRepository.cs
Last active July 6, 2017 11:44
CosmosTransactionalRepository
public interface CosmosTransactionalRepository<TKey, TValue> where TKey : IComparable<TKey>, IEquatable<TKey>
{
event EventHandler<NotifyDictionaryChangedEventArgs<TKey, TValue>> DictionaryChanged;
Task AddAsync(ITransaction tx, TKey key, TValue value);
Task<TValue> AddOrUpdateManyAsync(ITransaction tx, KeyValuePair<TKey, TValue>> records, Func<TKey, TValue, TValue> updateValueFactory, TimeSpan timeout = default, CancellationToken cancellationToken = default);
Task<TValue> AddOrUpdateAsync(ITransaction tx, TKey key, TValue addValue, Func<TKey, TValue, TValue> updateValueFactory, TimeSpan timeout = default, CancellationToken cancellationToken = default);
Task<TValue> GetOrAddAsync(ITransaction tx, TKey key, TValue value, TimeSpan timeout, CancellationToken cancellationToken);
@bklooste
bklooste / IMemoryIndex.cs
Last active July 16, 2017 02:40
IMemoryIndex
public class FieldSelector<TValue>: Expression<Func<TValue, object>> {}
public interface IIndexedDictionary<TKey, TValue> : IEnumerable<TValue>
where TKey : IEquatable<TKey>
{
// I dont see the value vs 2 steps , maybe accross multiple indexes...
// purposes is to apply a brute force predicate on an index eg ( x => return (x == myName); )
IEnumerable<KeyValuePair<TKey,TIndexType>> GetSlice<TIndexType>(FieldSelector<TValue> field, TIndexType minValue = default(TIndexType), TIndexType maxValue = default(TIndexType) );
// the following which returns the objects has not been included so consumers can interact with the store explicitly.
using System.Threading.Tasks;
using Cosmos.Common.Contracts;
using System;
// fixme
namespace Cosmos.Services
{