Exemple #1
0
        public void GetTeammate()
        {
            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.GetTeammate(subject.ID))
            .Returns(subject)
            .Verifiable();

            var result = facade.GetTeammate(subject.ID);

            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.GetTeammate(It.IsAny <long>()), Times.Once);
        }
Exemple #2
0
        public IHttpActionResult GetTeammate([FromUri] long id)
        {
            var target = searchFacade.GetTeammate(id);

            return(Ok(target));
        }