Пример #1
0
        public void CanGetLockBuilderUsingStringAlias()
        {
            ILockBuilder <IImmediateFlowQuery <UserEntity> > builder = DummyQuery <UserEntity>()
                                                                       .Lock("user");

            Assert.That(builder, Is.Not.Null);
        }
Пример #2
0
        public void CanGetLockBuilder()
        {
            ILockBuilder <IImmediateFlowQuery <UserEntity> > builder = DummyQuery <UserEntity>()
                                                                       .Lock();

            Assert.That(builder, Is.Not.Null);
        }
Пример #3
0
        public void CanUpdateLockModeWithoutAlias()
        {
            ILockBuilder <IImmediateFlowQuery <UserEntity> > builder = DummyQuery <UserEntity>()
                                                                       .Lock();

            Assert.That(builder, Is.Not.Null);

            var query = (IFlowQuery)builder.Upgrade();

            Assert.That(query.Locks.Count, Is.EqualTo(1));

            Lock only = query.Locks.Single();

            Assert.That(only.Alias, Is.Null);
            Assert.That(only.LockMode, Is.EqualTo(LockMode.Upgrade));

            builder.Read();

            Assert.That(query.Locks.Count, Is.EqualTo(1));

            only = query.Locks.Single();

            Assert.That(only.Alias, Is.Null);
            Assert.That(only.LockMode, Is.EqualTo(LockMode.Read));
        }
Пример #4
0
        public void CanGetLockBuilderUsingExpressionAlias()
        {
            UserEntity user = null;

            ILockBuilder <IImmediateFlowQuery <UserEntity> > builder = DummyQuery <UserEntity>()
                                                                       .Lock(() => user);

            Assert.That(builder, Is.Not.Null);
        }
Пример #5
0
        public void CanSetLockModeWithAliasUsingString()
        {
            ILockBuilder <IImmediateFlowQuery <UserEntity> > builder = DummyQuery <UserEntity>()
                                                                       .Lock("user");

            Assert.That(builder, Is.Not.Null);

            var query = (IFlowQuery)builder.Upgrade();

            Assert.That(query.Locks.Count, Is.EqualTo(1));

            Lock only = query.Locks.Single();

            Assert.That(only.Alias, Is.EqualTo("user"));
            Assert.That(only.LockMode, Is.EqualTo(LockMode.Upgrade));
        }
 public LaunchLockProcess(
     IConfiguration configuration,
     ILockFinder lockFinder,
     ILockReader lockReader,
     ILockBuilder lockBuilder,
     ILockWriter lockWriter,
     ICommunicator communicator,
     IFileSystem fileSystem,
     IUnlocker unlocker,
     ILauncher launcher)
 {
     Configuration = configuration ?? throw new System.ArgumentException(nameof(configuration));
     LockFinder    = lockFinder ?? throw new ArgumentException(nameof(lockFinder));
     LockBuilder   = lockBuilder ?? throw new ArgumentException(nameof(lockBuilder));
     LockReader    = lockReader ?? throw new ArgumentException(nameof(lockReader));
     LockWriter    = lockWriter ?? throw new ArgumentException(nameof(lockWriter));
     Communicator  = communicator ?? throw new ArgumentException(nameof(communicator));
     FileSystem    = fileSystem ?? throw new ArgumentException(nameof(fileSystem));
     Unlocker      = unlocker ?? throw new ArgumentException(nameof(unlocker));
     Launcher      = launcher ?? throw new ArgumentException(nameof(launcher));
 }
Пример #7
0
 public Unlocker(IFileSystem fileSystem, ILockReader lockReader, ILockBuilder lockBuilder)
 {
     FileSystem  = fileSystem ?? throw new ArgumentException(nameof(fileSystem));
     LockReader  = lockReader ?? throw new ArgumentException(nameof(lockReader));
     LockBuilder = lockBuilder ?? throw new ArgumentException(nameof(lockBuilder));
 }
Пример #8
0
 public LockWriter(IFileSystem fileSystem, IJsonOperations jsonSerializer, ILockBuilder lockBuilder)
 {
     FileSystem     = fileSystem ?? throw new ArgumentException(nameof(fileSystem));
     JsonOperations = jsonSerializer ?? throw new ArgumentException(nameof(jsonSerializer));
     LockBuilder    = lockBuilder ?? throw new ArgumentException(nameof(lockBuilder));
 }