public void CanAddRegistration()
        {
            // ARRANGE
            _registration = CreateRegistration();

            // ACT
            var newRegistration = _subjectUnderTest.Add(_registration);

            // ASSERT
            Assert.That(newRegistration.Id, Is.Not.EqualTo(Guid.Empty));
        }
Exemplo n.º 2
0
        public void CanSetName()
        {
            // ARRANGE
            var expectedName = NSubstitute.Substitute.For<Name>();
            var subjectUnderTest = new Registration();

            // ACT
            subjectUnderTest.Name = expectedName;

            // ASSERT
            Assert.That(subjectUnderTest.Name, Is.SameAs(expectedName));
        }
Exemplo n.º 3
0
        public void CanSetRespondedOn()
        {
            // ARRANGE
            var expectedRespondedOn = DateTime.Now;
            var subjectUnderTest = new Registration();

            // ACT
            subjectUnderTest.RespondedOn = expectedRespondedOn;

            // ASSERT
            Assert.That(subjectUnderTest.RespondedOn, Is.EqualTo(expectedRespondedOn));
        }
Exemplo n.º 4
0
        public void CanSetId()
        {
            // ARRANGE
            var expectedId = Guid.NewGuid();
            var subjectUnderTest = new Registration();

            // ACT
            subjectUnderTest.Id = expectedId;

            // ASSERT
            Assert.That(subjectUnderTest.Id, Is.EqualTo(expectedId));
        }
Exemplo n.º 5
0
        public RegistrationDto Rsvp(NewAcceptanceMessage message)
        {
            var name = new Name {First = message.FirstName, Last = message.LastName};
            var registration = new Registration
            {
                Id = Guid.Empty,
                Message = message.Message,
                Name = name,
                RespondedOn = DateTime.Now
            };

            _registrationRepository.Add(registration);

            return Mapper.Map<RegistrationDto>(registration);
        }
Exemplo n.º 6
0
        public RegistrationDto Rsvp(NewAcceptanceMessage message)
        {
            var name = new Name {First = message.FirstName, Last = message.LastName};
            var registration = new Registration
            {
                Message = message.Message,
                Name = name,
            };

            registration.Register();

            _registrationRepository.Add(registration);

            return Mapper.Map<RegistrationDto>(registration);
        }
        private Registration CreateRegistration()
        {
            var name = new Name
            {
                First = "John",
                Last = "Doe"
            };

            var registration = new Registration
            {
                Id = Guid.Empty,
                Name = name,
                Message = $"Thank you for hosting this event!"
            };

            return registration;
        }
 public void TearDown()
 {
     _registration = null;
     _subjectUnderTest = null;
 }
Exemplo n.º 9
0
 public Registration Add(Registration registration)
 {
     var addedRegistration = _registrations.Add(registration);
     _dbContext.SaveChanges();
     return addedRegistration;
 }