Exemplo n.º 1
0
        public async Task Contact_Create_RequestsCorrectResource()
        {
            Http.RespondWith(m =>
            {
                Assert.Equal("POST", m);
                Assert.Equal("http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/contact", Http.Url.ToString());
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "Contact with id [4711] has been created.", Id = "4711" } } };
            });

            var contact = new RealtorContactDetails { Lastname = "Meiser" };

            await Client.Contacts.CreateAsync(contact);
        }
Exemplo n.º 2
0
        public async Task Contact_Create_CallSucceeds_RealEstateObjectHasNewId()
        {
            Http.RespondWith(m =>
            {
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "Contact with id [4711] has been created.", Id = "4711" } } };
            });

            var contact = new RealtorContactDetails { Lastname = "Meiser" };

            await Client.Contacts.CreateAsync(contact);

            Assert.Equal(4711, contact.Id);
        }
Exemplo n.º 3
0
        public async Task Contact_Update_ExternalIdIsUsedIfIdIsNull()
        {
            Http.RespondWith(m =>
            {
                Assert.Equal("http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/contact/ext-test", Http.Url.ToString());
                var c = new BaseXmlDeserializer().Deserialize<RealtorContactDetails>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<RealtorContactDetails>(c);
                Assert.Null(c.Id);
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var contact = new RealtorContactDetails { ExternalId = "test" };

            await Client.Contacts.UpdateAsync(contact);
        }
Exemplo n.º 4
0
        public async Task Contact_Update_PostsRealEstateObject()
        {
            Http.RespondWith(m =>
            {
                var c = new BaseXmlDeserializer().Deserialize<RealtorContactDetails>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<RealtorContactDetails>(c);
                Assert.Equal(4711, c.Id);
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var contact = new RealtorContactDetails { Id = 4711 };

            await Client.Contacts.UpdateAsync(contact);
        }
Exemplo n.º 5
0
        public async Task Contact_Create_CallSucceeds_NoExceptionThrown()
        {
            Http.RespondWith(m =>
            {
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var contact = new RealtorContactDetails { Id = 4711 };

            await Client.Contacts.UpdateAsync(contact);
        }
Exemplo n.º 6
0
        public async Task Contact_Update_RequestsCorrectResource()
        {
            Http.RespondWith(m =>
            {
                Assert.Equal("PUT", m);
                Assert.Equal("http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/contact/4711", Http.Url.ToString());
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var contact = new RealtorContactDetails { Id = 4711 };

            await Client.Contacts.UpdateAsync(contact);
        }
Exemplo n.º 7
0
        public async Task Contact_Create_PostsRealtorObject()
        {
            Http.RespondWith(m =>
            {
                var c = new BaseXmlDeserializer().Deserialize<RealtorContactDetails>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<RealtorContactDetails>(c);
                Assert.Equal("Meiser", c.Lastname);
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "Contact with id [4711] has been created.", Id = "4711" } } };
            });

            var contact = new RealtorContactDetails { Lastname = "Meiser" };

            await Client.Contacts.CreateAsync(contact);
        }