private DataTableRecord CreateRecord() { var record = MockData.CreateInstance <DataTableRecord>(); record.date_received = DateTime.Now.ToString("yyyy-MM-dd"); return(record); }
public void Match_WithCorrespondingPupMlstRecord_FindsMatchAndCreatesPubMlstIsolate() { var sut = CreatePubMlstMatcher(); var pubMlstIsolate = MockData.CreateInstance <NeisseriaPubMlstIsolate>(); pubMlstIsolate.PubMlstId = 18377; _pubMlstService.GetIsolateByReference("DE1").Returns(pubMlstIsolate); var result = sut.Match(new FromToQuery { From = _firstDayMorning, To = _firstDayMorning.AddDays(1) }); var match = result.First(); match.PubMlstId.Should().Be(18377); match.StemNumber.Should().Be("DE1"); var pubMlstIsolateId = match.NeisseriaPubMlstIsolateId.Should().HaveValue().And.Subject; _database.NeisseriaPubMlstIsolates.Find(pubMlstIsolateId).Should().NotBeNull(); var isolate = _database.MeningoIsolates.First(); isolate.NeisseriaPubMlstIsolate.Should().NotBeNull(); match.LaboratoryNumber.Should().Be(isolate.LaboratoryNumberWithPrefix); }
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>()); } }
public void AssignStemNumber_ExistingIsolate_DoesNotRecreateStemNumber() { var controller = CreateMockSendingController(); var sending = DbMock.Sendings.Single(s => s.SendingId == MockData.SecondId); sending.Isolate = MockData.CreateInstance <Isolate>(); sending.Isolate.Year = 2099; sending.Isolate.YearlySequentialIsolateNumber = 999; controller.CreateSendingAndAssignStemAndLaboratoryNumber(sending); sending.Isolate.Year.Should().Be(2099); sending.Isolate.YearlySequentialIsolateNumber.Should().Be(999); }
public void Setup() { Sending = CreateInstance <MeningoSending>(); Sending.Isolate.EpsilometerTests.Clear(); Counties = new List <County>(); for (var i = 1; i < 4; i++) { var county = MockData.CreateInstance <County>(); county.CountyId = i; county.CountyNumber = (12064000 + i).ToString(); Counties.Add(county); } }
public void Create_AssignsClinicalInformation() { var controller = CreateController(); requestForm.Set("ClinicalInformation", "Pneumonia,Sepsis"); var patient = MockData.CreateInstance <Patient>(); controller.Create(new PatientSendingViewModel <Patient, Sending> { Patient = patient, Sending = MockData.CreateInstance <Sending>() }); var patientInDatabase = DbMock.Patients.Last(); patientInDatabase.Initials.Should().Be(patient.Initials); patientInDatabase.ClinicalInformation.Should().Be(ClinicalInformation.Sepsis | ClinicalInformation.Pneumonia); }
public void AssignStemNumber_SendingWithoutAutoAssignStemNumber_AssignsCorrectLaboratoryNumberButNoStemNumber() { var expectedLaboratoryNumber = $"001/{DateTime.Now:yy}"; var controller = CreateMockSendingController(); var sending = MockData.CreateInstance <NoAutoAssignStemNumberSending>(); sending.SendingId = 123; sending.SenderId = MockData.FirstId; sending.PatientId = MockData.FirstId; sending.Isolate = null; controller.CreateSendingAndAssignStemAndLaboratoryNumber(sending); var isolate = sending.Isolate; isolate.Should().NotBeNull(); isolate.LaboratoryNumber.Should().Be(expectedLaboratoryNumber); isolate.StemNumber.HasValue.Should().BeFalse(); }
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>(); }
public void Match_WithEmptyStemNumber_DoesNotCallPubMlstService() { var sut = CreatePubMlstMatcher(); var pubMlstIsolate = MockData.CreateInstance <NeisseriaPubMlstIsolate>(); pubMlstIsolate.PubMlstId = 18377; _pubMlstService.GetIsolateByReference("DE1").Returns(pubMlstIsolate); var result = sut.Match(new FromToQuery { From = _firstDayMorning, To = _firstDayMorning.AddDays(5) }); var match = result.Last(); match.PubMlstId.Should().NotHaveValue(); match.NeisseriaPubMlstIsolateId.Should().NotHaveValue(); match.StemNumber.Should().Be("DE -"); match.LaboratoryNumber.Should().Be(_database.MeningoIsolates.Last().LaboratoryNumberWithPrefix); _pubMlstService.Received(4).GetIsolateByReference(Arg.Any <string>()); }
public void Setup() { Sending = MockData.CreateInstance <Sending>(); Sending.Isolate.EpsilometerTests.Clear(); Sending.Isolate.EpsilometerTests.Add(MockData.CreateInstance <EpsilometerTest>()); }