public PatientControllerShould(ITestOutputHelper testOutputHelper)
        {
            Mapper.Reset();
            SeedMapperConfiguration automapConfiguration = new SeedMapperConfiguration();

            this.medicalRecordMock = new Mock <IMedicalRecordNumberService>();
            this.medicalRecordMock.Setup(p => p.GetMedicalRecordNumber(It.IsAny <string>()))
            .Returns(MockedMedicalRecordNumber);
            this.xunitLogger = new XunitLogger <PatientController>(testOutputHelper);


            this.mapper     = automapConfiguration.CreateMapper();
            this.sutBuilder =
                new PatientControllerBuilder(this.mapper, this.medicalRecordMock.Object).WithLogger(this.xunitLogger);
            this.mockRepositories      = new Mock <IUnitOfWork>();
            this.mockPatientRepository = new Mock <IPatientRepository>();
            this.mockAllergyRepository = new Mock <IAllergyRepository>();


            this.mockRepositories.Setup(p => p.Patients).Returns(this.mockPatientRepository.Object);
            this.mockRepositories.Setup(p => p.Allergies).Returns(this.mockAllergyRepository.Object);

            this.InitializeData();
            Test.CreateInstance();
        }
示例#2
0
        public void OneTimeSetup()
        {
            Environment.SetEnvironmentVariable("ALLURE_CONFIG",
                                               Path.Combine(Environment.CurrentDirectory, AllureConstants.CONFIG_FILENAME));

            Mapper.Reset();
            SeedMapperConfiguration automapConfiguration = new SeedMapperConfiguration();

            this.medicalRecordMock = new Mock <IMedicalRecordNumberService>();
            this.medicalRecordMock.Setup(p => p.GetMedicalRecordNumber(It.IsAny <string>()))
            .Returns(MockedMedicalRecordNumber);
            this.nuniLogger = new NunitLogger <PatientController>();

            this.mapper                = automapConfiguration.CreateMapper();
            this.mockRepositories      = new Mock <IUnitOfWork>();
            this.mockPatientRepository = new Mock <IPatientRepository>();
            Mock <IAllergyRepository> mockAllergyRepository = new Mock <IAllergyRepository>();

            this.mockRepositories.Setup(p => p.Patients).Returns(this.mockPatientRepository.Object);
            this.mockRepositories.Setup(p => p.Allergies).Returns(mockAllergyRepository.Object);

            this.InitializeData();
        }