I’m trying to mock ICountryFactory but with no luck. Here is the code:
var _countryFactory = new Mock<ICountryFactory>();
_countryFactory
.Setup(f => f.CreateCountry(It.IsAny<string>()))
.Returns(new Country
{
Name = "Switzerland"
});
And then I get these errors:
- The type 'PostalCodes.Country' has no constructors defined
- Property or indexer 'Name' cannot be assigned to -- it is read only
I’m trying to mock ICountryFactory but with no luck. Here is the code:
And then I get these errors: