Esempio n. 1
0
        public void CanSendMessageToQueueOnSuccessfulContactInsert()
        {
            Contact contact = Contact.Create(new Name("Julie", "Lerman"), "Friend Referral");
            var     repo    = new ContactAggregateRepository();

            repo.PersistNewContact(contact);

            Assert.Inconclusive("Check status of RabbitMQ Manager for this message");
        }
Esempio n. 2
0
        public void WillNotSendMessageToQueueOnSuccessfulContactAddressUpdate()
        {
            Contact contact = Contact.Create(new Name("George", "Jetson"), "Spacely Sprockets Referral");
            var     repo    = new ContactAggregateRepository();

            repo.PersistNewContact(contact);
            contact.CreateNewAddress("123 SkyPad Apartments", "", "Orbit City", "Orbit", "n/a", "");
            repo.PersistChangeToContact(contact);

            Assert.Inconclusive(@"Check status of RabbitMQ Manager for a create message, 
                          but no update message because name was not changed");
        }
Esempio n. 3
0
        public void CanSendMessageToQueueOnSuccessfulContactNameUpdate()
        {
            Contact contact = Contact.Create(new Name("Spamson", "Lerman"), "Friend Referral");
            var     repo    = new ContactAggregateRepository();

            repo.PersistNewContact(contact);
            contact.FixName(new Name("Sampson", "Lerman"));

            repo.PersistChangeToContact(contact);

            Assert.Inconclusive("Check status of RabbitMQ Manager for a create message and an update message");
        }
Esempio n. 4
0
        // POST api/<controller>
        //public Guid Post(HttpRequestMessage request) {
        //  var str = Request.Content.ReadAsStringAsync().Result;
        //  var c = Newtonsoft.Json.JsonConvert.DeserializeObject<ContactWithAddressDto>(str);
        //  return Guid.Empty;
        //}

        public Guid Post(HttpRequestMessage request)
        {
            var    repo = new ContactAggregateRepository();
            string str  = Request.Content.ReadAsStringAsync().Result;
            var    c    = JsonConvert.DeserializeObject <ContactWithAddressDto>(str);

            Contact contact = Contact.Create(new Name(c.FirstName, c.LastName), "Sales");
            var     cA      = c.PrimaryAddress;

            contact.CreateNewAddress(cA.Street1, cA.Street2, cA.City, cA.Region, cA.Country, cA.PostalCode);
            if (repo.PersistNewContact(contact))
            {
                return(contact.Id);
            }
            return(Guid.Empty);
        }