Ejemplo n.º 1
0
        public void Initialize()
        {
            _repo = (InMemoryIndividualRepository)Harness.GetRepo();

            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Phillipe", Surname = "Coutinho"
            });
            _repo.Add(new cIndividual {
                ID = 2, Firstname = "Bob", Surname = "Lalana"
            });
            _repo.Add(new cIndividual {
                ID = 4, Firstname = "Simon", Surname = "Mignolet"
            });
            _repo.Add(new cIndividual {
                ID = 5, Firstname = "Robert", Surname = "Firmino"
            });

            _controller = Harness.GetController(_repo);

            IList <cMatter> oMatters = new List <cMatter>();

            oMatters.Add(new cMatter {
                ID = "1", Description = "Test1"
            });
            oMatters.Add(new cMatter {
                ID = "2", Description = "Test2"
            });

            cCDD_Details oCDD = new cCDD_Details {
                ID = 1, CDDStatus = eCDDStatus.Complete
            };

            IList <cEntityRelationship> oER = new List <cEntityRelationship>();

            oER.Add(new cEntityRelationship {
                ID = 1, entityA_ID = 1, entityB_ID = 2, relType = eRelType.Director
            });

            cIndividual indiv = new cIndividual();

            indiv.ID          = 3;
            indiv.Firstname   = "Adam";
            indiv.Surname     = "Lalana";
            indiv.Matters     = oMatters;
            indiv.CDD_Details = oCDD;
            indiv.IsA         = oER;

            _repo.Add(indiv);
        }
Ejemplo n.º 2
0
        public void Create_Post_PutsValidContactIntoRepository()
        {
            // Arrange
            InMemoryIndividualRepository repository = new InMemoryIndividualRepository();
            cIndividualController        controller = Harness.GetController(repository);
            cIndividual indiv = GetIndividual();

            // Act
            controller.Create(indiv);

            // Assert
            IEnumerable <cIndividual> individuals = repository.GetAllIndividuals();

            Assert.IsTrue(individuals.Contains(indiv));
        }
Ejemplo n.º 3
0
        public void Initialize()
        {
            _repo = (InMemoryIndividualRepository)Harness.GetRepo();

            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Phillipe", Surname = "Coutinho"
            });
            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Bob", Surname = "Lalana"
            });
            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Adam", Surname = "Lalana"
            });
            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Simon", Surname = "Mignolet"
            });
            _repo.Add(new cIndividual {
                ID = 1, Firstname = "Robert", Surname = "Firmino"
            });

            _controller = Harness.GetController(_repo);
        }
Ejemplo n.º 4
0
        public void Index_Get_RetrievesAllContactsFromRepository()
        {
            // Arrange
            cIndividual indiv1 = GetIndividual(1, "address1", "jersey", new DateTime(2016, 9, 28), "aaron", "aardvark");
            cIndividual indiv2 = GetIndividual(2, "address2", "guernsey", new DateTime(2016, 9, 27), "brian", "baron");
            InMemoryIndividualRepository repository = new InMemoryIndividualRepository();

            repository.Add(indiv1);
            repository.Add(indiv2);
            var controller = Harness.GetController(repository);

            // Act
            var result = controller.Index(null);



            // Assert
            var model = (IList <cIndividual>)((ViewResult)result).ViewData.Model;

            CollectionAssert.Contains(model.ToList(), indiv1);
            CollectionAssert.Contains(model.ToList(), indiv2);
        }