Ejemplo n.º 1
0
        public void GetTeam()
        {
            var subject = new Teammate
            {
                FirstName = Faker.Name.First(),
                LastName  = Faker.Name.Last(),
                Address   = Faker.Address.StreetAddress(),
                City      = Faker.Address.City(),
                BirthDate = DateTime.Parse($"{Faker.RandomNumber.Next(1, 12)}/{Faker.RandomNumber.Next(1, 28)}/{Faker.RandomNumber.Next(1960, 2000)}"),
                ID        = Faker.RandomNumber.Next(1, 1000),
                Interests = Faker.Lorem.Sentence(3),
                IsStarter = Convert.ToBoolean(Faker.RandomNumber.Next(0, 1)),
                State     = Faker.Address.UsStateAbbr(),
                Zipcode   = Faker.Address.ZipCode(),
            };

            var mapped = mapper.Map <Teammate, GetTeammateResponse>(subject);

            service.Setup(x => x.GetTeam())
            .Returns(new List <Teammate>()
            {
                subject
            })
            .Verifiable();

            var result = facade.GetTeam().FirstOrDefault();

            Assert.IsNotNull(result);
            Assert.IsTrue(result.FirstName == mapped.FirstName &&
                          result.LastName == mapped.LastName &&
                          result.ID == mapped.ID &&
                          result.Interests == mapped.Interests &&
                          result.IsStarter == mapped.IsStarter &&
                          result.BirthDate.Equals(mapped.BirthDate) &&
                          result.Address == mapped.Address &&
                          result.Age == mapped.Age);
            service.Verify(x => x.GetTeam(), Times.Once);
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetTeam()
        {
            var target = searchFacade.GetTeam();

            return(Ok(target));
        }