public void SetCityInfo(CityWithInfo cityWithInfo, string info)
 {
     cityWithInfo.Info = info;
     cityWithInfo.EditHistory = "info=" + info;
 }
예제 #2
0
 public void SetCityInfo(CityWithInfo cityWithInfo, string info)
 {
     cityWithInfo.Info        = info;
     cityWithInfo.EditHistory = "info=" + info;
 }
        public void Inherit_Run_CUD_Insert_Derived()
        {
            // Inheritance is City <-- CityWithEditHistory <-- CityWithInfo
            CityDomainContext citiesContext= new CityDomainContext(TestURIs.Cities);
            DateTime priorLastUpdated = DateTime.Now;

            // Load all cities, not just derived ones
            LoadOperation lo = citiesContext.Load(citiesContext.GetCitiesQuery());
            SubmitOperation so = null;

            // wait for Load to complete
            EnqueueConditional(() => lo.IsComplete);

            EnqueueCallback(delegate
            {

                CityWithInfo newCity = new CityWithInfo() { Name = "CocoaVille", StateName = "WA", CountyName = "King", Info="stuff" };
                citiesContext.Cities.Add(newCity);

                so = citiesContext.SubmitChanges();
            });
            // wait for submit to complete
            EnqueueConditional(() => so.IsComplete);
            EnqueueCallback(delegate
            {
                if (so.Error != null)
                {
                    Assert.Fail("Unexpected error on submit: " + so.Error.Message);
                }

                // verify entities are auto-synced back to the client as a result of the domain method execution on server
                CityWithInfo newCity = citiesContext.Cities.OfType<CityWithInfo>().SingleOrDefault<CityWithInfo>(c => (c.Name == "CocoaVille"));
                Assert.IsNotNull(newCity, "Did not find modified City after the submit");
                Assert.IsTrue(newCity.EditHistory.Contains("insert"), "EditHistory was" + newCity.EditHistory);
            });

            EnqueueTestComplete();
        }
        public void AddingDerivedEntityIntoAbstractList()
        {
            // CityWithEditHistory is an abstract type
            this._dds.QueryName = "GetCitiesWithEditHistoryQuery";
            this._dds.DomainContext = new CityDomainContext();

            CityWithInfo derivedCity = new CityWithInfo();
            this._view.Add(derivedCity);

            Assert.AreEqual<int>(1, this._view.Count);
            Assert.AreSame(derivedCity, this._view[0]);
        }
예제 #5
0
 /// <summary>
 /// Invokes the 'SetCityInfo' method of the specified <see cref="CityWithInfo"/> entity.
 /// </summary>
 /// <param name="cityWithInfo">The <see cref="CityWithInfo"/> entity instance.</param>
 /// <param name="info">The value for the 'info' parameter for this action.</param>
 public void SetCityInfo(CityWithInfo cityWithInfo, string info)
 {
     cityWithInfo.SetCityInfo(info);
 }