示例#1
0
        public static void InitDb(TestContext context)
        {
            _infrastructure = new Infrastructure();

            //Prepare a dummy config for the temporary db file
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
                                                         .AddInMemoryCollection(new List <KeyValuePair <string, string> >()
            {
            });

            IConfiguration config = configurationBuilder.Build();

            _infrastructure.EnsureStorageCreated(config);
        }
示例#2
0
        public static void InitDb(TestContext context)
        {
            _infrastructure = new Infrastructure();

            _tempDbFilename = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.db");

            //Prepare a dummy config for the temporary db file
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
                                                         .AddInMemoryCollection(new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("litedb-path", _tempDbFilename)
            });

            IConfiguration config = configurationBuilder.Build();

            _infrastructure.EnsureStorageCreated(config);

            _repo = new ContactRepository(_infrastructure);
        }