示例#1
0
        public async Task Commit_CommitsTransaction()
        {
            // Arrange
            var service = new Service();
            var storage = new MemoryStorage();
            var trans   = TransactionFactory.CreateNew(storage);

            trans = await storage.CreateTransactionAsync(trans);

            service.Transaction = trans;

            // Act
            service.CompileAndRun(@"module foo;

await commit this;
");

            // Assert
            Assert.Equal(2, (await storage.FetchTransactionAsync(trans.Id)).Revision);
        }
示例#2
0
        public async Task Commit_WithExpression_CommitsTransaction()
        {
            // Arrange
            var service = new Service();
            var storage = new MemoryStorage();
            var trans   = TransactionFactory.CreateNew(storage);

            trans = await storage.CreateTransactionAsync(trans);

            service.Transaction = trans;

            // Act
            service.CompileAndRun(@"module foo;

await commit this with { Script: ""Foo"" };
");

            // Assert
            Assert.Equal("Foo", (await storage.FetchTransactionAsync(trans.Id)).Script);
        }