Beispiel #1
0
        public void Should_bootstrap_from_provided_data()
        {
            var data = new Faker <Dummy>().Generate(13);
            var ps   = new Params {
                Count = 10, Page = 1
            };
            var sut = new Result <Dummy>(ps, data.AsEnumerable(), 99);

            Assert.AreEqual(sut.Count, data.Count());
            Assert.AreEqual(sut.Desc, ps.Desc);
            Assert.AreEqual(sut.OrderBy, ps.OrderBy);
            Assert.AreEqual(sut.Page, ps.Page);
            Assert.AreEqual(sut.Total, 99);
        }
        public void Should_not_sort_provided_enumerable()
        {
            // Arrage
            var data = new Faker <Dummy>().Generate(13).OrderByDescending(d => d.Name);
            var ps   = new Params {
                Count = 10, Page = 1
            };

            // Act
            var sut = new Result <Dummy>(ps, data.AsEnumerable(), data.Count());

            // Assert
            Assert.AreEqual(sut.Data.First(), data.First());
            Assert.AreEqual(sut.Total, data.Count());
        }
        public void PacientesController_ObterConsultasPorMedico_RetornarComSucesso(string nome)
        {
            // Arrange
            var listConsultaViewModelFaker = new Faker <ListConsultaViewModel>("pt_BR")
                                             .RuleFor(r => r.Id, c => c.Random.Long())
                                             .RuleFor(r => r.DataAgendamento, c => c.Date.Recent(100))
                                             .RuleFor(r => r.MedicoId, c => c.Random.Long())
                                             .RuleFor(r => r.PacienteId, c => c.Random.Long())
                                             .Generate(5);

            mockMapper.Setup(m => m.Map <IEnumerable <ListConsultaViewModel> >(It.IsAny <IEnumerable <Consulta> >())).Returns(listConsultaViewModelFaker.AsEnumerable());

            // Act
            var result = consultasController.ObterConsultasPorMedico(nome).Result;

            // Assert
            Assert.IsType <OkObjectResult>(result);
        }