コード例 #1
0
        public void AddNewSociety()
        {
            SocietyRepositoryTestClass societyRepositoryTestClass = new SocietyRepositoryTestClass();
            Society newSociety = new Society()
            {
                Id = Guid.NewGuid(),
                City = "Pune",
                Description = "TestSocietyDesc",
                Address="Test Address",
                Disabled = false,
                Locality = "Aundh",
                Name = "TestSociety",
                State = "Maharashtra",
                ZipCode = "411020"
            };

            Society addedSociety = societyRepositoryTestClass.AddNewSociety(newSociety);
            Assert.IsTrue(addedSociety != null);
        }
コード例 #2
0
        public void UpdateSocietyDetails()
        {
            SocietyRepositoryTestClass societyRepositoryTestClass = new SocietyRepositoryTestClass();
            Society society = societyRepositoryTestClass.GetSocietyDetails(1);
            society.City = "kochi";
            society.ObjectState = ObjectState.Modified;

            // For Testing
            foreach(var building in society.Buildings)
            {
                building.ObjectState = ObjectState.Unchanged;
            }
            var b1=society.Buildings.Find(b => b.Description == "A1");
            b1.Name = "Test Building test A1";
            b1.ObjectState = ObjectState.Modified;

            var b2 = society.Buildings.Find(b => b.Description == "A-1");
            if(b2!=null)
            b2.ObjectState = ObjectState.Deleted;

            foreach (var house  in society.Houses)
            {
                house.ObjectState = ObjectState.Unchanged;
            }
            //For Testing...

            //var building = society.Buildings.ToArray();
            //if(building.Length>0)
            //{
            //    building[0].Name = "Updated1";
            //    building[0].ObjectState = ObjectState.Modified;
            //}

            Society societyUpdated = societyRepositoryTestClass.UpdateSociety(society);
            Assert.IsTrue(society != null);
        }
コード例 #3
0
 public void GetSocietyDetails()
 {
     SocietyRepositoryTestClass societyRepositoryTestClass = new SocietyRepositoryTestClass();
     Society society = societyRepositoryTestClass.GetSocietyDetails(1);
     Assert.IsTrue(society != null);
 }
コード例 #4
0
 public void UpdateSociety()
 {
     SocietyRepositoryTestClass societyRepositoryTestClass = new SocietyRepositoryTestClass();
     Society society = societyRepositoryTestClass.GetSociety(1);
     society.City = "Bang";
     Society societyUpdated = societyRepositoryTestClass.UpdateSociety(society);
     Assert.IsTrue(society != null);
 }
コード例 #5
0
        public void AddNewSocietyWithBuildingAndHouse()
        {
            SocietyRepositoryTestClass societyRepositoryTestClass = new SocietyRepositoryTestClass();

            Society newSociety = new Society()
            {
                Id = Guid.NewGuid(),
                City = "Pune",
                Description = "TestSocietyDesc4",
                Address = "Test Address3",
                Disabled = false,
                Locality = "Aundh",
                Name = "TestSociety4",
                State = "Maharashtra",
                ZipCode = "411020"
            };
            newSociety.Buildings.Add(new Building()
            {
                Id = Guid.NewGuid(),
                Description = "A4",
                Name = "Test Building4"
            });

            Society addedSociety = societyRepositoryTestClass.AddNewSociety(newSociety);
            Assert.IsTrue(addedSociety != null);
        }