コード例 #1
0
 /// <summary>
 /// Adds real estate objects to the real estate project identified by the specified id.
 /// </summary>
 /// <param name="realEstateProjectId">The id.</param>
 /// <param name="entries">Identifies the real estate objects.</param>
 /// <returns>
 /// The task object representing the asynchronous operation.
 /// </returns>
 public Task<RealEstateProjectEntries> AddAsync(long realEstateProjectId, RealEstateProjectEntries entries)
 {
     var req = Connection.CreateRequest("realestateproject/{id}/realestateprojectentry", Method.POST);
     req.AddParameter("id", realEstateProjectId, ParameterType.UrlSegment);
     req.AddBody(entries);
     return ExecuteAsync<RealEstateProjectEntries>(Connection, req);
 }
コード例 #2
0
        public async Task RealEstateProject_Create_CallSucceeds()
        {
            Http.RespondWith(m =>
            {
                var e = new BaseXmlDeserializer().Deserialize<RealEstateProjectEntries>(new RestResponse { Content = Http.RequestBody });
                Assert.IsType<RealEstateProjectEntries>(e);
                Assert.Equal(1, e.RealEstateProjectEntry.Count);
                Assert.Equal(1, e.RealEstateProjectEntry.Single().RealEstateId);

                return new RealEstateProjectEntries
                {
                    RealEstateProjectEntry = { new RealEstateProjectEntry { RealEstateId = 1,
                        MessageCode = MessageCode.MESSAGE_RESOURCE_CREATED, Message = "real estate with id 1 was added to project 4711"  } }
                };
            });

            var entries = new RealEstateProjectEntries { RealEstateProjectEntry = { new RealEstateProjectEntry { RealEstateId = 1 } } };
            var result = await Client.RealEstateProjects.AddAsync(4711, entries);

            Assert.Equal(MessageCode.MESSAGE_RESOURCE_CREATED, result.RealEstateProjectEntry.Single().MessageObject.MessageCode);
            Assert.Equal(1, result.RealEstateProjectEntry.Single().RealEstateId);
        }
コード例 #3
0
 /// <summary>
 /// Adds real estate objects to the real estate project identified by the specified id.
 /// </summary>
 /// <param name="realEstateProjectId">The id.</param>
 /// <param name="realEstates">Identifies the real estate objects.</param>
 /// <returns>
 /// The task object representing the asynchronous operation.
 /// </returns>
 public Task<RealEstateProjectEntries> AddAsync(long realEstateProjectId, IEnumerable<RealEstate> realEstates)
 { 
     var entries = new RealEstateProjectEntries();
     foreach (var entry in realEstates.Select(r => new RealEstateProjectEntry { RealEstateId = r.Id.Value }))
         entries.RealEstateProjectEntry.Add(entry);
     return AddAsync(realEstateProjectId, entries);
 }
コード例 #4
0
        public async Task RealEstateProject_Create_RequestsCorrectResource()
        {
            Http.RespondWith(m =>
            {
                Assert.Equal("POST", m);
                Assert.Equal("http://rest.sandbox-immobilienscout24.de/restapi/api/offer/v1.0/user/me/realestateproject/4711/realestateprojectentry", Http.Url.ToString());
                return new RealEstateProjectEntries();
            });

            var entries = new RealEstateProjectEntries();

            await Client.RealEstateProjects.AddAsync(4711, entries);
        }