示例#1
0
        public void AddNewCheckedInPatientToState()
        {
            var currentState = new List <PatientWithStatus>().AsReadOnly();
            var patientId    = Guid.NewGuid();

            var checkInChangedEvent = CheckInEventFactory.Create(patientId, CheckInStatus.CheckedIn, DateTime.Now);

            var newState = checkInChangedEvent.Process(currentState);

            newState.Should().Contain(p => p.PatientId == patientId);
        }
        private void RefreshEventStream()
        {
            var patients = Enumerable.Range(1, 10).Select(_ => Guid.NewGuid()).ToList();

            _events = Enumerable.Range(1, 100).Select(i =>
            {
                var patientId = patients.RandomElementUsing(_random);
                var status    = IEnumerableExtensions.RandomEnumValue <CheckInStatus>(_random);
                var date      = new Bogus.DataSets.Date().Between(DateTime.Today.AddYears(-1), DateTime.Today);
                return(CheckInEventFactory.Create(patientId, status, date));
            }).ToList();
        }
示例#3
0
        public void UpdateStatusOfExistingPatient()
        {
            var patientId = Guid.NewGuid();
            var currentState = new List <PatientWithStatus> {
                new PatientWithStatus(patientId, CheckInStatus.CheckedIn, DateTimeOffset.Now.ToUnixTimeSeconds())
            }.AsReadOnly();

            var checkInChangedEvent = CheckInEventFactory.Create(patientId, CheckInStatus.SamplingStarted, DateTime.Now);

            var newState = checkInChangedEvent.Process(currentState);

            var target = newState.First(p => p.PatientId == patientId);

            target.CheckInStatus.Should().Be(CheckInStatus.SamplingStarted);
        }