Example #1
0
            public void Addevents_Valid()
            {
                var events = new EventsModel()
                {
                    Date        = "2014-07-18",
                    Artist      = "Uhhhhh",
                    Description = "I don't think they host events here anymore?",
                    EndTime     = "22:30:00",
                    StartTime   = "15:30:00"
                };
                var venue = new VenueModel()
                {
                    Name         = "Lancaster events Center",
                    Address      = "4100 N 84th St, Lincoln, NE 68507",
                    PhoneNumber  = "4024416545",
                    EmailAddress = "*****@*****.**"
                };

                var connectionFactory = new ConnectionFactory();

                var eventsDataProvider = new EventsDataProvider(connectionFactory);
                var eventsBuilder      = new EventsBuilder(eventsDataProvider);

                eventsBuilder.Addevents(events, venue);
            }
            public void GetEventsTest_GetConnectionException()
            {
                _connectionFactoryMock.Setup(x => x.GetConnection()).Throws(new Exception());

                var eventsDataProvider = new EventsDataProvider(_connectionFactoryMock.Object);

                eventsDataProvider.Getevents();
            }
            public void GetEventsTest_CreateCommandFailed()
            {
                _connectionFactoryMock.Setup(x => x.GetConnection()).Returns(_dbConnectionMock.Object);
                _dbConnectionMock.Setup(x => x.Open());
                _dbConnectionMock.Setup(x => x.CreateCommand()).Throws(new Exception());

                var eventsDataProvider = new EventsDataProvider(_connectionFactoryMock.Object);

                eventsDataProvider.Getevents();
            }
            public void GetEventsTest_OpenException()
            {
                var connection = new SqlConnection();

                _connectionFactoryMock.Setup(x => x.GetConnection()).Returns(connection);
                _dbConnectionMock.Setup(x => x.Open()).Throws(new Exception());

                var eventsDataProvider = new EventsDataProvider(_connectionFactoryMock.Object);

                eventsDataProvider.Getevents();
            }