예제 #1
0
        public void Should_Not_Set_CreatorId_If_Current_User_Is_Not_Available()
        {
            AuditPropertySetter.SetCreationProperties(TargetObject);

            TargetObject.CreationTime.Subtract(Now).TotalSeconds.ShouldBeLessThanOrEqualTo(TimeSubtractSeconds);
            TargetObject.CreatorId.ShouldBe(null);
        }
예제 #2
0
        public void Should_Set_CreatorId_If_Entity_Tenant_Is_Same_With_Current_User_Tenant()
        {
            CurrentUserId = Guid.NewGuid();

            AuditPropertySetter.SetCreationProperties(TargetObject);

            TargetObject.CreationTime.Subtract(Now).TotalSeconds.ShouldBeLessThanOrEqualTo(TimeSubtractSeconds);
            TargetObject.CreatorId.ShouldBe(CurrentUserId);
        }
예제 #3
0
        public void Should_Not_Set_CreatorId_If_It_Is_Already_Set()
        {
            var oldCreatorUserId = Guid.NewGuid();

            CurrentUserId          = Guid.NewGuid();
            TargetObject.CreatorId = oldCreatorUserId;

            AuditPropertySetter.SetCreationProperties(TargetObject);

            TargetObject.CreationTime.Subtract(Now).TotalSeconds.ShouldBeLessThanOrEqualTo(TimeSubtractSeconds);
            TargetObject.CreatorId.ShouldBe(oldCreatorUserId);
        }
예제 #4
0
        public void Should_Set_CreationTime()
        {
            AuditPropertySetter.SetCreationProperties(TargetObject);

            TargetObject.CreationTime.Subtract(Now).TotalSeconds.ShouldBeLessThanOrEqualTo(TimeSubtractSeconds);
        }
예제 #5
0
 public void Should_Do_Nothing_For_Non_Audited_Entity()
 {
     AuditPropertySetter.SetCreationProperties(new MyEmptyObject());
 }