|
|
@ -35,9 +35,6 @@ namespace Volo.Abp.TestApp.Testing
|
|
|
|
var creatingEventTriggered = false;
|
|
|
|
var creatingEventTriggered = false;
|
|
|
|
var createdEventTriggered = false;
|
|
|
|
var createdEventTriggered = false;
|
|
|
|
var createdEtoTriggered = false;
|
|
|
|
var createdEtoTriggered = false;
|
|
|
|
var updatedEtoTriggered = false;
|
|
|
|
|
|
|
|
var updatingEventTriggered = false;
|
|
|
|
|
|
|
|
var updatedEventTriggered = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var uow = GetRequiredService<IUnitOfWorkManager>().Begin())
|
|
|
|
using (var uow = GetRequiredService<IUnitOfWorkManager>().Begin())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -45,18 +42,14 @@ namespace Volo.Abp.TestApp.Testing
|
|
|
|
{
|
|
|
|
{
|
|
|
|
creatingEventTriggered.ShouldBeFalse();
|
|
|
|
creatingEventTriggered.ShouldBeFalse();
|
|
|
|
createdEventTriggered.ShouldBeFalse();
|
|
|
|
createdEventTriggered.ShouldBeFalse();
|
|
|
|
updatingEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
updatedEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
creatingEventTriggered = true;
|
|
|
|
creatingEventTriggered = true;
|
|
|
|
|
|
|
|
|
|
|
|
data.Entity.Name.ShouldBe(personName);
|
|
|
|
data.Entity.Name.ShouldBe(personName);
|
|
|
|
|
|
|
|
|
|
|
|
/* Want to change age from 15 to 18
|
|
|
|
/* Want to change age from 15 to 18 */
|
|
|
|
* Expect to trigger EntityUpdatingEventData, EntityUpdatedEventData events */
|
|
|
|
|
|
|
|
data.Entity.Age.ShouldBe(15);
|
|
|
|
data.Entity.Age.ShouldBe(15);
|
|
|
|
data.Entity.Age = 18;
|
|
|
|
data.Entity.Age = 18;
|
|
|
|
PersonRepository.Update(data.Entity);
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
return Task.CompletedTask;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -64,8 +57,6 @@ namespace Volo.Abp.TestApp.Testing
|
|
|
|
{
|
|
|
|
{
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
createdEventTriggered.ShouldBeFalse();
|
|
|
|
createdEventTriggered.ShouldBeFalse();
|
|
|
|
updatingEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
updatedEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createdEventTriggered = true;
|
|
|
|
createdEventTriggered = true;
|
|
|
|
|
|
|
|
|
|
|
@ -84,46 +75,6 @@ namespace Volo.Abp.TestApp.Testing
|
|
|
|
return Task.CompletedTask;
|
|
|
|
return Task.CompletedTask;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
LocalEventBus.Subscribe<EntityUpdatingEventData<Person>>(data =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
createdEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
updatingEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
updatedEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updatingEventTriggered = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.Entity.Name.ShouldBe(personName);
|
|
|
|
|
|
|
|
data.Entity.Age.ShouldBe(18);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalEventBus.Subscribe<EntityUpdatedEventData<Person>>(data =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
createdEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
updatingEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
updatedEventTriggered.ShouldBeFalse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updatedEventTriggered = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.Entity.Name.ShouldBe(personName);
|
|
|
|
|
|
|
|
data.Entity.Age.ShouldBe(18);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DistributedEventBus.Subscribe<EntityUpdatedEto<PersonEto>>(eto =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
eto.Entity.Name.ShouldBe(personName);
|
|
|
|
|
|
|
|
eto.Entity.Age.ShouldBe(18);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updatedEtoTriggered = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PersonRepository.Insert(new Person(Guid.NewGuid(), personName, 15));
|
|
|
|
PersonRepository.Insert(new Person(Guid.NewGuid(), personName, 15));
|
|
|
|
|
|
|
|
|
|
|
|
uow.Complete();
|
|
|
|
uow.Complete();
|
|
|
@ -132,9 +83,6 @@ namespace Volo.Abp.TestApp.Testing
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
creatingEventTriggered.ShouldBeTrue();
|
|
|
|
createdEventTriggered.ShouldBeTrue();
|
|
|
|
createdEventTriggered.ShouldBeTrue();
|
|
|
|
createdEtoTriggered.ShouldBeTrue();
|
|
|
|
createdEtoTriggered.ShouldBeTrue();
|
|
|
|
updatingEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
updatedEventTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
updatedEtoTriggered.ShouldBeTrue();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|