Ejemplo n.º 1
0
        public async Task RealEstate_Create_CallSucceeds_RealEstateObjectHasNewId()
        {
            Http.RespondWith(m =>
            {
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "RealEstate with id [4711] has been created.", Id = "4711" } } };
            });

            var re = new ApartmentRent { Title = "Test" };

            await Client.RealEstates.CreateAsync(re);

            Assert.Equal(4711, re.Id);
        }
Ejemplo n.º 2
0
        public async Task RealEstate_Create_RequestsCorrectResource()
        {
            Http.RespondWith(m =>
            {
                Assert.Equal("POST", m);
                Assert.Equal("http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/realestate", Http.Url.GetLeftPart(UriPartial.Path));
                Assert.Equal("?usenewenergysourceenev2014values=true", Http.Url.Query); 
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "RealEstate with id [4711] has been created.", Id = "4711" } } };
            });

            var re = new ApartmentRent { Title = "Test" };

            await Client.RealEstates.CreateAsync(re);
        }
Ejemplo n.º 3
0
        public async Task RealEstate_Create_CallSucceeds_NoExceptionThrown()
        {
            Http.RespondWith(m =>
            {
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var re = new ApartmentRent { Id = 4711, Title = "Test" };

            await Client.RealEstates.UpdateAsync(re);
        }
Ejemplo n.º 4
0
        public async Task RealEstate_Update_PostsRealEstateObject()
        {
            Http.RespondWith(m =>
            {
                var re = new BaseXmlDeserializer().Deserialize<RealEstate>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<ApartmentRent>(re);
                Assert.Equal(4711, re.Id);
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_UPDATED, MessageProperty = "" } } };
            });

            var r = new ApartmentRent { Id = 4711, Title = "Test" };

            await Client.RealEstates.UpdateAsync(r);
        }
Ejemplo n.º 5
0
        public async Task RealEstate_Create_PostsRealEstateObject()
        {
            Http.RespondWith(m =>
            {
                var re = new BaseXmlDeserializer().Deserialize<RealEstate>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<ApartmentRent>(re);
                Assert.Equal("Test", re.Title);
                return new Messages { Message = { new Message { MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, MessageProperty = "RealEstate with id [4711] has been created.", Id = "4711" } } };
            });

            var r = new ApartmentRent { Title = "Test" };

            await Client.RealEstates.CreateAsync(r);
        }