public IKeyService CreateService(KeyRackOptions options) { var timeKeeper = new TimeKeeper(options); var serializer = new DefaultKeySerializer(); var repository = new FileSystemKeyRepository(_keysDirectoryPath, _loggerFactory.CreateLogger <FileSystemKeyRepository>()); return(new KeyService(options, repository, serializer, timeKeeper, _loggerFactory.CreateLogger <KeyService>())); }
public IKeyService CreateService(KeyRackOptions options) { var timeKeeper = new TimeKeeper(options); var serializer = new DefaultKeySerializer(); _context = new KeyDbContext(_dbContextOptions); _context.Database.EnsureCreated(); var repository = new EntityFrameworkKeyRepository(_context, _loggerFactory.CreateLogger <EntityFrameworkKeyRepository>()); return(new KeyService(options, repository, serializer, timeKeeper, _loggerFactory.CreateLogger <KeyService>())); }
public void TestDefaultKeySerializer() { var q1 = new AddQuery { Left = 1, Right = 2 }; var q2 = new AddQuery { Left = 1, Right = 2 }; var q3 = new AddQuery { Left = 1, Right = 3 }; var keySer = new DefaultKeySerializer <AddQuery>(); Assert.Equal(keySer.SerializeToString(q1), keySer.SerializeToString(q2)); Assert.NotEqual(keySer.SerializeToString(q1), keySer.SerializeToString(q3)); }