I have an enum declared as
when I try to use that in a parameter in a Mocking Arrange, it doesn't match and the mock doesn't get called correctly.
In this case s returns null.
If I remove the type from the enum (or change it to int) the above code returns the correct instance as expected.
Thanks,
Eric
public enum SubdivisionTypeCode : byte
{
None = 255,
State = 0,
County = 1,
City = 2,
Village = 3,
Township = 4,
CitySchoolDistrict = 5,
SchoolDistrict = 6,
JtVocSchoolDistrict = 7,
Miscellaneous = 8,
University = 9,
PooledFinancing = 10
}
when I try to use that in a parameter in a Mocking Arrange, it doesn't match and the mock doesn't get called correctly.
public interface ISubdivisionTypeRepository
{
ISubdivisionType Get(SubdivisionTypeCode subdivisionTypeCode);
}
...
[Test]
var subdivisionTypeCode = SubdivisionTypeCode.City;
var subdivisionType = new SubdivisionType(subdivisionTypeCode: SubdivisionTypeCode.City);
var subdivisionTypeRepository = Mock.Create<
ISubdivisionTypeRepository
>();
Mock.Arrange(() => subdivisionTypeRepository.Get(subdivisionTypeCode)).Returns(subdivisionType);
var s = subdivisionTypeRepository.Get(subdivisionTypeCode);
If I remove the type from the enum (or change it to int) the above code returns the correct instance as expected.
Thanks,
Eric