Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Kloosterman bklooste

View GitHub Profile
View gist:c52e1ec6f04a2f323363a507ac5e5dd9
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 Jul 6, 2017
CosmosTransactionalRepository
View CosmosTransactionalRepository.cs
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);
View IMemoryIndex.cs
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.
View ICrudService
using System.Threading.Tasks;
using Cosmos.Common.Contracts;
using System;
// fixme
namespace Cosmos.Services
{