Created
July 31, 2012 00:28
-
-
Save mabster/3212270 to your computer and use it in GitHub Desktop.
Create farrowing for gestating sow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Test] | |
| public void Create_farrowing_for_gestating_sow() | |
| { | |
| byte parity = 1; | |
| var farrowing = new Farrowing | |
| { | |
| Id = Guid.NewGuid(), | |
| Date = new DateTime(2011, 3, 22), | |
| Farm = new PigX.Farms.Farm(), | |
| Shed = "F", | |
| Pen = 17, | |
| }; | |
| var mating = new Mating | |
| { | |
| Id = Guid.NewGuid(), | |
| Date = farrowing.Date.AddDays(-116), | |
| Fate = GestationFate.Gestating, | |
| }; | |
| var pig = new Pig | |
| { | |
| Id = Guid.NewGuid(), | |
| Farm = farrowing.Farm, | |
| Parity = parity, | |
| Lactation = null, | |
| Gestation = mating, | |
| }; | |
| farrowing.Pig = new Pig { Id = pig.Id }; | |
| _repository.Setup(r => r.GetPig(farrowing.Pig.Id)).Returns(pig); | |
| _repository.Setup(r => r.Add(farrowing)).Returns(farrowing); | |
| _repository.Setup(r => r.SaveChanges()).Returns(1); | |
| var result = _service.CreateFarrowing(farrowing); | |
| Assert.AreEqual(ValidationResult.Success, result); | |
| Assert.IsNull(pig.Gestation); | |
| Assert.AreEqual(GestationFate.Farrowed, mating.Fate); | |
| Assert.AreEqual(farrowing, mating.FateEvent); | |
| Assert.AreEqual(farrowing, pig.Lactation); | |
| Assert.AreEqual(parity + 1, pig.Parity); | |
| Assert.AreEqual(farrowing.Shed, pig.Shed); | |
| Assert.AreEqual(farrowing.Pen, pig.Pen); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment