예제 #1
0
        public void GET_Export()
        {
            //Arrange
            var patient = new Patient
            {
                Id = 123,
                NbrSurveillances = new List <NbrSurveillance>(),
                Hypothermias     = new List <Hypothermia>(),
                Monitorings      = new List <Monitoring>()
            };
            var searchResult = new List <Patient> {
                patient
            };

            _patientService.Setup(
                x =>
                x.DeepSearch(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                             It.IsAny <PatientStatus>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>()))
            .Returns(searchResult.ToPagedList(1, 10));

            //Act
            var result = _controller.Export("123", "123", "123", "name", "surnames", PatientStatus.Closed,
                                            DateTime.Today.AddDays(-1).ToShortDateString(), DateTime.Today.AddDays(1).ToShortDateString(), "id_a");

            //Assert
            Assert.That(result.FileStream, Is.Not.Null);
            Assert.That(result.ContentType, Is.EqualTo("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
            Assert.That(result.FileDownloadName, Is.EqualTo(Strings.ExportedFileName + ".xlsx"));
        }