public void ReturnEmptyCollection_WhenUsernameIsNull()
        {
            // Arrange
            var mockedEfWrappert = new Mock <IEfDbSetWrapper <Individual> >();
            var mockedDbContext  = new Mock <IUnitOfWork>();

            var service = new IndividualService(mockedEfWrappert.Object, mockedDbContext.Object);

            // Act
            var result = service.GetCurrentEvents(null);

            // Assert
            Assert.IsEmpty(result);
        }
        public void ReturnCorrectCollection_WhenUsernameMatch()
        {
            // Arrange
            var data        = new List <Individual>();
            var currentDate = new DateTime(2017, 1, 1, 00, 00, 00);
            var event1      = new Event();

            event1.Begins = currentDate.AddDays(1);
            event1.Ends   = currentDate.AddDays(2);
            var event2 = new Event();

            event2.Begins = currentDate.AddDays(-1);
            event2.Ends   = currentDate.AddDays(1);
            var user     = new User();
            var username = "******";

            user.UserName = username;
            var individual = new Individual();

            individual.User = user;
            individual.Events.Add(event1);
            individual.Events.Add(event2);
            data.Add(individual);

            var mockedEfWrappert = new Mock <IEfDbSetWrapper <Individual> >();

            mockedEfWrappert.Setup(x => x.All).Returns(data.AsQueryable());
            var mockedDbContext = new Mock <IUnitOfWork>();
            var mockedDateTime  = new Mock <DateTimeProvider>();

            mockedDateTime.SetupGet(x => x.UtcNow).Returns(currentDate);
            DateTimeProvider.Current = mockedDateTime.Object;

            var service = new IndividualService(mockedEfWrappert.Object, mockedDbContext.Object);

            // Act
            var result = service.GetCurrentEvents(username);

            DateTimeProvider.ResetToDefault();

            // Assert
            Assert.AreEqual(1, result.Count());
            Assert.AreSame(event2, result.First());
        }