Beispiel #1
0
        public void Equipments_Valid_NonEmpty()
        {
            Equipments equipments = new Equipments();

            Mock <Equipment> equipment = GetMockEquipment();

            equipment.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true);

            equipments.Add(equipment.Object);

            ValidationCode errorCode = ValidationCode.SUCCESS;

            // need to suppress the type check because moq uses a different type
            Assert.IsTrue(equipments.IsValidRecordSet(ref errorCode, suppressTypeCheck: true));
        }
Beispiel #2
0
        public void Equipments_Invalid_BadType()
        {
            Equipments equipments = new Equipments();

            Mock <Equipment> equipment = GetMockEquipment();

            equipment.Setup(s => s.IsValid(ref It.Ref <ValidationCode> .IsAny)).Returns(true);

            equipments.Add(equipment.Object);

            ValidationCode errorCode = ValidationCode.SUCCESS;

            // do not suppress type check. Since moq uses a different type anyway,
            // there is no need to test with a different IRecord type
            Assert.IsFalse(equipments.IsValidRecordSet(ref errorCode, suppressTypeCheck: false));
        }