Exemple #1
0
 public void SetUp()
 {
     DbMock = new ApplicationDbContextMock();
     MockData.CreateMockData(DbMock);
     patientController = new PatientController(DbMock);
     sendingController = new SendingController(DbMock);
     foreach (var sending in DbMock.Sendings)
     {
         sending.Isolate = MockData.CreateInstance <Isolate>();
         sending.Isolate.EpsilometerTests.Clear();
         sending.Isolate.EpsilometerTests.Add(MockData.CreateInstance <EpsilometerTest>());
     }
 }
Exemple #2
0
        public void SetUp()
        {
            DbMock = new ApplicationDbContextMock();
            IsolateViewModelMappingActionBase.DbForTest = DbMock;
            controller = new ReportController(DbMock);
            var context = new Mock <HttpContextBase>();
            var server  = new Mock <HttpServerUtilityBase>(MockBehavior.Loose);

            server.Setup(i => i.MapPath(ReportController.ReportTemplatesPath))
            .Returns(TemporaryDirectoryToStoreTestData);
            context.SetupGet(x => x.Server).Returns(server.Object);
            controller.ControllerContext = new ControllerContext(context.Object, new RouteData(), controller);

            ConfigurationManager.AppSettings["reportSigners"] = "signer1";

            CreateMockReportTemplates();

            CreateMockData();
        }
Exemple #3
0
        public void Setup()
        {
            _database = new ApplicationDbContextMock();
            MockData.CreateMockData(_database);

            for (int i = 0; i < 5; i++)
            {
                var isolate = MockData.CreateInstance <MeningoIsolate>();
                var sending = MockData.CreateInstance <MeningoSending>();
                sending.SamplingDate            = i == 3 ? null : (DateTime?)_firstDayMorning.AddDays(i).AddHours(8);
                sending.ReceivingDate           = _firstDayMorning.AddDays(i).AddHours(8);
                isolate.Sending                 = sending;
                isolate.StemNumber              = i == 4 ? null : (int?)i + 1;
                isolate.NeisseriaPubMlstIsolate = null;
                _database.MeningoIsolates.Add(isolate);
            }

            _pubMlstService = Substitute.For <PubMlstService>();
        }
Exemple #4
0
        public static void CreateMockData(ApplicationDbContextMock dbContext)
        {
            for (var i = FirstId; i < EntityCount; i++)
            {
                var patient = Catalog.CreateInstance <Patient>();
                patient.PatientId = i;
                dbContext.PatientDbSet.Add(patient);

                var sender = Catalog.CreateInstance <Sender>();
                sender.SenderId = i;
                dbContext.Senders.Add(sender);

                var sending = Catalog.CreateInstance <Sending>();
                sending.PatientId = i;
                sending.SenderId  = i;
                sending.SendingId = i;
                sending.Isolate   = null;
                dbContext.Sendings.Add(sending);
            }

            for (var i = FirstId; i < EntityCount; i++)
            {
                var patient = Catalog.CreateInstance <MeningoPatient>();
                patient.PatientId = i;
                dbContext.MeningoPatientsDbSet.Add(patient);

                var sender = Catalog.CreateInstance <Sender>();
                sender.SenderId = i;
                dbContext.Senders.Add(sender);

                var sending = Catalog.CreateInstance <MeningoSending>();
                sending.MeningoPatientId = i;
                sending.SenderId         = i;
                sending.MeningoSendingId = i;
                sending.Isolate          = null;
                dbContext.MeningoSendings.Add(sending);
            }
        }
Exemple #5
0
 internal SendingController CreateMockSendingController()
 {
     DbMock = new ApplicationDbContextMock();
     MockData.CreateMockData(DbMock);
     return(new SendingController(DbMock));
 }
Exemple #6
0
 public void SetUp()
 {
     DbMock = new ApplicationDbContextMock();
     IsolateViewModelMappingActionBase.DbForTest = DbMock;
     CreateMockData();
 }