public void Init() { // OK _calf1 = new ASREMLCalf { CalfSn = 1, StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // OK _calf2 = new ASREMLCalf { CalfSn = 2, StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // Not OK : wrong strain _calf3 = new ASREMLCalf { CalfSn = 3, StrainCode = "M2", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // OK _calf4 = new ASREMLCalf { CalfSn = 54321, StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2005 }; _originalList = new List<ASREMLCalf> { _calf1, _calf2, _calf3, _calf4 }; _sut = new FixMissingGJDamCalfSn(DateTime.Now.Year - 1, "M1", 91, _originalList); _filterCalvesWithoutDamCalfSNs = _sut.FilterCalvesWithoutDamCalfSNs(); Assert.AreEqual(3, _filterCalvesWithoutDamCalfSNs.Count()); _newCalves = _sut.GenerateNewCalves(_filterCalvesWithoutDamCalfSNs); Assert.AreEqual(3, _newCalves.Count()); }
public void Init() { // make some test calves // OK _calf1 = new ASREMLCalf { StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // OK _calf2 = new ASREMLCalf { StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // Not OK : wrong strain _calf3 = new ASREMLCalf { StrainCode = "M2", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // Not OK : wrong herd id _calf4 = new ASREMLCalf { StrainCode = "M1", HerdId = 22, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // Not OK : wrong birth year _calf5 = new ASREMLCalf { StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2009"), DamCalfSn = int.MaxValue, DamBirthYear = 2007 }; // Not OK : has a Dam Calf SN _calf6 = new ASREMLCalf { StrainCode = "M1", HerdId = 91, BirthDate = DateTime.Parse("1-Mar-2010"), DamCalfSn = 123, DamBirthYear = 2007 }; }