How would I go about mocking a property on a method that returns a list of properties.
public class Data
{
public string Property1 {get: set;}
public string Property2 {get: set;}
public string Property3 {get: set;}
}
public Data GetData(bool paramVal){
Data myData = new Data();
myData.Property1 = "Value1",
myData.Property2 = "Value2",
myData.Property3 = "Value3"
return myData
}
How do I setup my mock on this method so that I can set the values in the properties?
What I tried:
MyDataBo = new Mock<IDataBo>`(); //(this is injected into my test class as a dependency)
MyDataBo.Setup(x => x.GetData(It.IsAny<bool>()).Property1).Returns("Value");`
It compiles but I get an error when debugging my test:
System.NotSupportedException: Unsupported express...
How can I mock Property1
or all the properties?