public void ReadManyTest() { var descriptionAttribute1 = new DescriptionAttribute("fad"); var descriptionAttribute2 = new DescriptionAttribute("fadawdawd"); _attributesReader.Setup(x => x.ReadMany(typeof(DescriptionAttribute), typeof(string))).Returns(new object[] { descriptionAttribute1, descriptionAttribute2 }).Verifiable(); var attrs = _attributesReader.Object.ReadMany<DescriptionAttribute>(typeof (string)).ToList(); Assert.AreEqual(2, attrs.Count); Assert.AreEqual(descriptionAttribute1, attrs[0]); Assert.AreEqual(descriptionAttribute2, attrs[1]); }
public void ReadSafeTest() { object exp = new DescriptionAttribute("aawd"); _attributesReader.Setup(x => x.ReadMany(typeof(DescriptionAttribute),typeof (string))).Returns(new[] {exp}).Verifiable(); var actual = _attributesReader.Object.ReadSafe<DescriptionAttribute>(typeof (string)); Assert.AreEqual(exp, actual); }
public void ReadTest() { var descriptionAttribute = new DescriptionAttribute("fad"); _attributesReader.Setup(x => x.ReadMany(typeof(DescriptionAttribute), typeof(string))).Returns(new object[] { descriptionAttribute }).Verifiable(); Assert.AreEqual(descriptionAttribute, _attributesReader.Object.Read<DescriptionAttribute>(typeof(string))); }