public async Task ContestQueryInteractor_GetAllContestsAsync_RepositoryFailure_ReturnsNull()
        {
            mockContestRepository.Setup(c => c.ReadAsync()).Returns(Task.FromResult(new Result <IEnumerable <Contest> >(null)));

            var contestQueryInteractor = new ContestQueryInteractor(mockContestRepository.Object, mockLogger.Object);
            var result = await contestQueryInteractor.GetAllContestsAsync();

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNull(result.Value);
        }
        public async Task ContestQueryInteractor_GetAllContestsAsync_RepositoryFailure_Exception()
        {
            var exceptionMessage = "Derp";

            mockContestRepository.Setup(p => p.ReadAsync()).Throws(new Exception(exceptionMessage));
            var contestQueryInteractor = new ContestQueryInteractor(mockContestRepository.Object, mockLogger.Object);

            var result = await contestQueryInteractor.GetAllContestsAsync();

            Assert.IsTrue(result.IsFaulted);
            Assert.IsNull(result.Value);
            Assert.IsNotNull(result.Error.Exception);
            Assert.AreEqual(exceptionMessage, result.Error.ErrorMessage);
        }
        public async Task ContestQueryInteractor_GetAllContestsAsync_HappyPath()
        {
            var id                = "dfasdjfasldf";
            var date              = DateTimeOffset.Now;
            var name              = "2017 SASS April";
            var rounds            = new Dictionary <int, Round>();
            var numOfFlyoffRounds = 0;

            var contest = new Contest
            {
                Id                   = id,
                StartDate            = date,
                Name                 = name,
                NumberOfFlyoffRounds = numOfFlyoffRounds,
                Rounds               = rounds
            };

            var contest2 = new Contest
            {
                Id                   = "dfksjdwr",
                StartDate            = DateTimeOffset.Now.AddDays(-1),
                Name                 = "2017 SASS May",
                Rounds               = rounds,
                NumberOfFlyoffRounds = 1
            };

            var contests = new List <Contest> {
                contest, contest2
            };

            mockContestRepository.Setup(c => c.ReadAsync()).Returns(Task.FromResult(new Result <IEnumerable <Contest> >(contests)));

            var contestQueryInteractor = new ContestQueryInteractor(mockContestRepository.Object, mockLogger.Object);
            var result = await contestQueryInteractor.GetAllContestsAsync();

            Assert.IsFalse(result.IsFaulted);
            Assert.IsNotNull(result.Value);
            Assert.AreEqual(2, result.Value.Count());
        }