public void SubmitMessage(ContactMessage contactMessage) { _contactMessageRepository.Save(contactMessage); switch (contactMessage.Type) { case ContactMessageTypes.ContactUs: SubmitContactUsMessage(contactMessage); break; case ContactMessageTypes.Feedback: SubmitFeedbackMesage(contactMessage); break; default: _logService.Error("Invalid contact message type '{0}' for id {1}", contactMessage.Type, contactMessage.EntityId); break; } }
public void ShouldSaveContactMessage() { // Arrange. var contactMessage = new ContactMessage { UserId = TestUserId, Name = "Jane Doe", Email = "*****@*****.**", Enquiry = "I've forgotten my password", Details = "I've still forgotten my password" }; // Act. _repository.Save(contactMessage); // Assert. var mongoContactMessage = _collection.FindOne(_query); mongoContactMessage.UserId.Should().Be(contactMessage.UserId); mongoContactMessage.Name.Should().Be(contactMessage.Name); mongoContactMessage.Email.Should().Be(contactMessage.Email); mongoContactMessage.Enquiry.Should().Be(contactMessage.Enquiry); mongoContactMessage.Details.Should().Be(contactMessage.Details); }