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); }
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); }
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); }
public void Should_Set_CreationTime() { AuditPropertySetter.SetCreationProperties(TargetObject); TargetObject.CreationTime.Subtract(Now).TotalSeconds.ShouldBeLessThanOrEqualTo(TimeSubtractSeconds); }
public void Should_Do_Nothing_For_Non_Audited_Entity() { AuditPropertySetter.SetCreationProperties(new MyEmptyObject()); }