예제 #1
0
        public async Task ChangeTestEntityPostWithprocessTest()
        {
            var entity = new TestEntity();
            var payload = new ChangeTestEntityPayload()
            {
                Name = "Name 1",
                Description = "Description 1"
            };

            Assert.Null(entity.Id);
            Assert.Null(entity.Name);
            Assert.Null(entity.Description);
            var changeContext = new TestEntitiesStore(_conveyor);

            await changeContext.ChangeEntity(entity, payload);

            Assert.AreEqual("Name 1", entity.Name);
            Assert.NotNull(entity.Id);
            Assert.AreEqual("Description 1", entity.Description);

            Assert.Null(entity.Timestamp);

            await changeContext.AfterChangeEntity(entity, payload);

            Assert.NotNull(entity.Timestamp);
        }
예제 #2
0
        public async Task EntitiyHandlersList()
        {
            var entity = new TestEntity();
            var payload = new ChangeTestEntityPayload()
            {
                Name = "Name 1",
                Description = "Description 1"
            };

            Assert.Null(entity.Id);
            Assert.Null(entity.Name);
            Assert.Null(entity.Description);
            var changeContext = new TestEntitiesStore(_conveyor);

            await changeContext.ChangeEntityManual(entity, payload);

            Assert.AreEqual("Name 1", entity.Name);
            Assert.NotNull(entity.Description);
            Assert.NotNull(entity.Id);
            

        }
예제 #3
0
        public async Task ChangeTestEntityWithRollbackTest()
        {
            var entity = new TestEntity();
            var payload = new ChangeTestEntityPayload()
            {
                //Name = "Name 1",
                Description = "Description 1"
            };

            Assert.Null(entity.Id);
            Assert.Null(entity.Name);
            Assert.Null(entity.Description);
            var changeContext = new TestEntitiesStore(_conveyor);

            try
            {
                await changeContext.ChangeEntity(entity, payload);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                await changeContext.RollbackChangeEntitiy(entity, payload);
                Assert.Greater(entity.FailCount,0);
                return;
            }

            Assert.AreEqual("Name 1", entity.Name);
            Assert.NotNull(entity.Id);
            Assert.AreEqual("Description 1", entity.Description);

            Assert.Null(entity.Timestamp);

            await changeContext.AfterChangeEntity(entity, payload);

            Assert.NotNull(entity.Timestamp);
        }