예제 #1
0
        public void Load_WillReturnExpectedAssociation()
        {
            // Arrange
            var expectedResult = new PredsAssociation { PredsAssociationId = 1 };
            var fakeRepository = new Mock<IPredsAssociationRepository>();
            fakeRepository.Setup(x => x.Load(1)).Returns(expectedResult);

            var service = new PredsAssociationService(fakeRepository.Object, null);

            // Act
            var result = service.Load(1);

            // Assert
            Assert.That(result.PredsAssociationId, Is.EqualTo(1));
        }
예제 #2
0
        public void GetFirstLeagueWithSpaces_NoLeagueFound_ReturnsNull()
        {
            // Arrange
            var league1 = new League { PlayerRegistrations = new List<LeaguePlayer> { new LeaguePlayer(), new LeaguePlayer() } };

            var association = new PredsAssociation { PlayersPerLeague = 2, Leagues = new List<League> { league1 } };

            var fakeRepository = new Mock<IPredsAssociationRepository>();
            fakeRepository.Setup(x => x.Load(1)).Returns(association);

            var service = new PredsAssociationService(fakeRepository.Object, null);

            // Act
            var result = service.GetFirstLeagueWithSpaces(1);

            // Assert
            Assert.That(result, Is.Null);
        }