Ejemplo n.º 1
0
        public void GetVolunteersForDate_DoesNotReturnDuplicatePeople_WhenCommitmentsOverlap()
        {
            var mockData = new Mock<IDataService>();
            var commitments = new List<Commitment>();
            commitments.Add(new Commitment { DisasterId = 42, StartDate = DateTime.Today.AddDays(-2), EndDate = DateTime.Today.AddDays(1), PersonId = 1 });
            commitments.Add(new Commitment { DisasterId = 42, StartDate = DateTime.Today.AddDays(-1), EndDate = DateTime.Today.AddDays(2), PersonId = 1 });
            mockData.Setup(x => x.Commitments).Returns(commitments.AsQueryable());
            var disasters = new List<Disaster>();
            disasters.Add(new Disaster { Id = 42, Name = "disaster", IsActive = true });
            mockData.Setup(x => x.Disasters).Returns(disasters.AsQueryable());
            var persons = new List<Person>();
            persons.Add(new Person { Id = 1, ClusterId = 2 });
            mockData.Setup(x => x.Persons).Returns(persons.AsQueryable());

            var underTest = new AdminService(mockData.Object);

            var actual = underTest.GetVolunteersForDate(42, DateTime.Today);

            Assert.AreEqual(1, actual.Count());
        }
Ejemplo n.º 2
0
        public void WhenOneVolunteerHasRegisteredReturnOneRecordInRange()
        {
            initializeDisasterCollection(disasterWithCommitments);
            initializeVolunteerCollection(personWithCommitments);
            initializeCommitmentCollection(commitment);

            var underTest = new AdminService(mockService.Object);

            var result = underTest.GetVolunteersForDate(disasterWithCommitments, new DateTime(2013, 08, 12));

            Assert.AreEqual(1, result.Count());
        }