예제 #1
0
        public void ThrowException_WhenPassedNullEvent()
        {
            // Arrange
            var eventRepositoryMock = new Mock <IGenericRepository <Event> >();

            // Act
            var eventService = new BetSystem.Services.EventService(eventRepositoryMock.Object);

            // Assert
            Assert.Throws <ArgumentNullException>(() => eventService.AddEvent(null));
        }
예제 #2
0
        public void ThrowException_WhenPassedOddForSecondTeamLessThanOne()
        {
            // Arrange
            var eventRepositoryMock = new Mock <IGenericRepository <Event> >();
            var eventModel          = new EventDTO()
            {
                EventName         = "Roma vs Inter",
                OddsForFirstTeam  = 1,
                OddsForDraw       = 1,
                OddsForSecondTeam = 0,
                EventStartDate    = new DateTime(19, 1, 1, 1, 1, 1)
            };

            // Act
            var eventService = new BetSystem.Services.EventService(eventRepositoryMock.Object);

            // Assert
            Assert.Throws <ArgumentOutOfRangeException>(() => eventService.AddEvent(eventModel));
        }