public static void Init(TestContext context) { IConfiguration configurationProvider = CreateConfigurationProvider(); ICosmosFactory cosmosactory = new CosmosFactory(configurationProvider); _cosmosRepository = new SqlCosmosRepository(cosmosactory); }
public static void Init(TestContext context) { IConfiguration configurationProvider = CreateConfigurationProvider(); ICosmosFactory cosmosfactory = new CosmosFactory(configurationProvider); _cosmosRepository = A.Fake <SqlCosmosRepository>(arg => arg.WithArgumentsForConstructor(new object[] { cosmosfactory })); IRedisCacheFactory redisCacheFactory = new RedisCacheFactory(configurationProvider); _redisRepository = new RedisRepository(redisCacheFactory); _writeThroughStrategy = A.Fake <WriteThroughStrategy>(x => x.WithArgumentsForConstructor(new Object[] { _redisRepository, _cosmosRepository })); }
public static void Init(TestContext context) { IConfiguration configurationProvider = CreateConfigurationProvider(); ICosmosFactory cosmosfactory = new CosmosFactory(configurationProvider); // creating a fake instance of cosmos so as to be able to asset the invocations using fakeiteasy // note: this is fake instance and does not hold a reference to the actual cosmos DB _cosmosRepository = A.Fake <ICosmosRepository>(); IRedisCacheFactory redisCacheFactory = new RedisCacheFactory(configurationProvider); _redisRepository = new RedisRepository(redisCacheFactory); _readThroughStrategy = A.Fake <ReadThroughStrategy>(x => x.WithArgumentsForConstructor(new Object[] { _redisRepository, _cosmosRepository })); }
static void Main(string[] args) { IConfiguration config = new ConfigurationBuilder(). SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "AppSettings")) .AddJsonFile(ConfigFileName) .Build(); //Create the redis factory - substitute any factory in this place IRedisCacheFactory redisFactory = new RedisCacheFactory(config); //Create the cosmos factory ICosmosFactory cosmosFactory = new CosmosFactory(config); //Create the redis store instance IRedisRepository redisStore = new RedisRepository(redisFactory); //Create the cosmos store instance ICosmosRepository cosmosStore = new SqlCosmosRepository(cosmosFactory); //create the write-through cache strategy /*ICacheStrategy cacheStrategy = new WriteThroughCache(redisStore, cosmosStore); * //create an instance of the test execution class * var cacheOperationsTest = new ExecuteCacheStrategy(cacheStrategy);*/ // Read Values from command line or read data from file }