public void DetailsBadIdTest()
        {
            int?id = null;

            var mockRepo = new Mock <IPlantBreedingRepo>();


            var controller = new DefaultController(mockRepo.Object);

            var response = controller.Details(id) as HttpStatusCodeResult;

            Assert.IsNotNull(response);
            Assert.IsTrue(response.StatusCode == 400);
        }
        public void DetailsNullTest()
        {
            int?     id       = 12;
            Genotype expected = null;

            var mockRepo = new Mock <IPlantBreedingRepo>();

            mockRepo.Setup(r => r.GetGenotype(id.Value)).Returns(expected);

            var controller = new DefaultController(mockRepo.Object);

            var response = controller.Details(id) as HttpNotFoundResult;

            Assert.IsNotNull(response);
            Assert.IsTrue(response.StatusCode == 404);
        }
        public void DetailsHappyTest()
        {
            int?id       = 12;
            var genotype = new Genotype
            {
                Id           = 12,
                SelectionNum = 2,
                GivenName    = "bananas",
                FamilyId     = 14,
                Year         = "2005",
                Note         = null,
                Fate         = null,
                ExternalId   = 14141,
                IsRoot       = true,
                Alias1       = null,
                Alias2       = null,
                OriginalName = "plantain",
                PatentApp    = null,
                Patent       = null,
                PatentYear   = null,
                PloidyName   = null,
                CrossPlanId  = null,
                CreatedDate  = null,
                IsPopulation = false
            };
            var fam = new Family
            {
                Id                       = 14,
                CrossNum                 = "4486",
                FieldPlantedNum          = 144,
                TransplantedNum          = null,
                GenusId                  = 3,
                IsReciprocal             = null,
                OriginId                 = 108,
                SeedNum                  = 650,
                CrossTypeId              = null,
                Purpose                  = null,
                FemaleParent             = null,
                MaleParent               = null,
                ReciprocalString         = "N",
                BaseGenotypeId           = 14141,
                FemaleParentOriginalName = "plant",
                MaleParentOriginalName   = "tain",
                Unsuccessful             = false
            };

            genotype.Family = fam;

            var mockRepo = new Mock <IPlantBreedingRepo>();

            mockRepo.Setup(r => r.GetGenotype(id.Value)).Returns(genotype);
            mockRepo.Setup(r => r.GetFamily(id.Value)).Returns(fam);

            var controller = new DefaultController(mockRepo.Object);

            var response = controller.Details(id.Value) as ViewResult;

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Model);
            Assert.IsNotNull(response.Model as AccessionViewModel);

            var actual = response.Model as AccessionViewModel;

            Assert.AreEqual(genotype.Id, actual.Id);
        }