-
Notifications
You must be signed in to change notification settings - Fork 291
Closed
Labels
Description
Description
I was trying to get the new UI in VS for data driven tests. And getting the object for the data source to correctly serialize is so painful.
My contains other objects and getting it to work took me a lot of time.
Is there any additional guidance on this? Or a method that can check if the type is eligible for the new UI?
From what I see:
- Get Set properties need to be used, and default constructor must be present.
[Serialize]needs to be used for all the objects.- Abstract class must not be used.
- When inheriting, the objects must be produced exactly using the type that is used in the data source object, but not as any child class.
- Using records or readonly record struct does not make this easier.
- I could not get it to work when there was a collection on the object, but I might be just confused by some other edge case that was preventing me from getting this to work at the same time.
e.g. This works:
[Serializable]
public class OtherInfo : OtherInfoBase {
}
[Serializable]
public class OtherInfoBase {
public string Name {get; set;}
}
[Serializable]
public class RunnerInfo {
public string Name {get; set;}
public OtherInfo {get; set;}
}BUT making the RunnerInfo use the Base class, it only works when we assign the BaseClass itself, but not if we create OtherInfo and assign it:
[Serializable]
public class OtherInfo : OtherInfoBase {
}
[Serializable]
public class OtherInfoBase {
public string Name {get; set;}
}
[Serializable]
public class RunnerInfo {
public string Name {get; set;}
public OtherInfoBase {get; set;}
}