protected override void Context() { DbContext = new PRToolsEntities(); DocumentRepository = new DocumentRepository(DbContext, new TimeProvider()); _transactionScope = new TransactionScope(); using (_transactionScope) { TestCustomer = new Customer { CustomerType = DbContext.CustomerTypes.FirstOrDefault(), GooglePlacesURL = "GooglePlacesURL", TwitterHandle = "TwitterHandle", WebsiteURL = "WebsiteURL", ListName = "ListName", Name = "Name", ParentCustomerId = 0, Phone = "555-555-5555", }; DbContext.Customers.AddObject(TestCustomer); TestDocument = new Document { Title = "TestTitle", Body = "This is a test body", CreatedByUsername = "******", CreatedDate = new DateTime(2011, 1, 1), }; DbContext.Documents.AddObject(TestDocument); DbContext.SaveChanges(); } }
protected override void Context() { base.Context(); var franchise = new Customer {Name = FranchiseName}; CustomerService.Stub( x => x.QuickSearchCustomers(Arg<string>.Is.Equal(Username), Arg<QuickSearchCustomersRequest>.Is.Anything)) .Return(new List<Customer> { franchise, franchise, franchise, }); }
private bool SendCURL(CustomerDocumentURL curl, Customer customer) { var client = new SmtpClient("localhost"); string hosturl = ConfigurationManager.AppSettings["HostUrl"]; string url = string.Format("{0}{1}{2}", hosturl, "/Document/CURL?guid=", curl.URLKey); string toAddr = customer.PrimaryContactEmail; string fromAddr = ConfigurationManager.AppSettings["CustomerSupportEmailAddress"]; var mailMessage = new MailMessage(fromAddr, toAddr) { Subject = "New PRTools Document: " + curl.Title, Body = string.Format( "Copy and paste URL into browser to view and edit this PR Release: {0}", url) }; try { client.Send(mailMessage); curl.Status = CustomerDocumentURLStatus.OutForReview; _documentRepository.Update(curl); return true; } catch (Exception e) { return false; } }