Skip to content

Commit

Permalink
Update UnitTestsHelper.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvand committed Jul 19, 2024
1 parent e2f3f4a commit 3097e7a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Yvand.EntraCP.Tests/UnitTestsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public object Clone()
return this.MemberwiseClone();
}

public abstract TestEntity CreateEntityFromDataSourceRow(Row row);
public abstract void SetEntityFromDataSourceRow(Row row);
}

public class TestUser : TestEntity
Expand All @@ -204,15 +204,14 @@ public class TestUser : TestEntity
public string GivenName;
public bool IsMemberOfAllGroups = false;

public override TestEntity CreateEntityFromDataSourceRow(Row row)
public override void SetEntityFromDataSourceRow(Row row)
{
Id = row["id"];
DisplayName = row["displayName"];
UserPrincipalName = row["userPrincipalName"];
UserType = String.Equals(row["userType"], ClaimsProviderConstants.MEMBER_USERTYPE, StringComparison.InvariantCultureIgnoreCase) ? UserType.Member : UserType.Guest;
Mail = row["mail"];
GivenName = row["givenName"];
return this;
}
}

Expand All @@ -222,13 +221,12 @@ public class TestGroup : TestEntity
public bool SecurityEnabled = true;
public bool AllTestUsersAreMembers = false;

public override TestEntity CreateEntityFromDataSourceRow(Row row)
public override void SetEntityFromDataSourceRow(Row row)
{
Id = row["id"];
DisplayName = row["displayName"];
GroupType = row["groupType"];
SecurityEnabled = Convert.ToBoolean(row["SecurityEnabled"]);
return this;
}
}

Expand Down Expand Up @@ -275,7 +273,7 @@ private IEnumerable<T> ReadDataSource()
foreach (Row row in dt.Rows)
{
T entity = new T();
entity = entity.CreateEntityFromDataSourceRow(row) as T;
entity.SetEntityFromDataSourceRow(row);
yield return entity;
}
}
Expand Down

0 comments on commit 3097e7a

Please sign in to comment.