Example #1
0
        public void Create_WithBlankNames_ThrowsArgumentExceptionException(string firstName, string lastName)
        {
            var entrantMap = new ConcurrentDictionary <int, Entrant>();
            var dal        = new EntrantDal(entrantMap);

            var entrant = new Entrant {
                FirstName = firstName, LastName = lastName
            };

            Assert.Throws <ArgumentException>(() => dal.Create(entrant));
            Assert.That(entrantMap, Is.Empty);
        }
Example #2
0
        public void Create_WithValidEntrant_AddToMap()
        {
            var entrantMap = new ConcurrentDictionary <int, Entrant>();
            var dal        = new EntrantDal(entrantMap);
            var entrant    = new Entrant {
                FirstName = "firstName", LastName = "lastName"
            };

            dal.Create(entrant);
            Assert.That(entrantMap.Count, Is.EqualTo(1));

            var firstItem = entrantMap.First().Value;

            Assert.That(firstItem.Id, Is.EqualTo(1));
        }
Example #3
0
        public void Create_WithNullEntrant_ThrowsArgumentNullException()
        {
            var dal = new EntrantDal();

            Assert.Throws <ArgumentNullException>(() => dal.Create(null));
        }