public void SendFeedback() { var mockEnvironment = new Mock <IHostingEnvironment>(); mockEnvironment.Setup(m => m.EnvironmentName).Returns("Hosting:UnitTestEnvironment"); mockEnvironment.Setup(m => m.ContentRootPath).Returns(AppDomain.CurrentDomain.BaseDirectory); mockEnvironment.Setup(m => m.WebRootPath).Returns(AppDomain.CurrentDomain.BaseDirectory); var pathProvider = new PathProvider(mockEnvironment.Object); var emailService = new EmailServices( new LoggerManager(mockEnvironment.Object), new PathProvider(mockEnvironment.Object), Options.Create(new AppSettings() { NoReplayMail = "*****@*****.**", NoReplayPassword = "******", SMTPHost = "smtp.yandex.ru", SMTPPort = 25 })); emailService.SendFeedBack("9061010909", "*****@*****.**", "Mr. Anderson", "Test message"); Assert.IsTrue(true); }
public ResponseFeedback SendQuestion([FromBody] RequestFeedback request) { emailService.SendFeedBack(request.Phone, request.Email, request.Name, request.Message); return(new ResponseFeedback()); }