Esempio n. 1
0
        public void TestSaveGroupWhenOtherOrganizationDebtsIsBadlyInformed()
        {
            ApplicationSettings dataParam = GetDataBaseParam(4, true);

            ClientServices services = new ClientServices(dataParam);

            Member leader = new Member {Tiers = {Id = 1}};
            Group group = AddGroup(true, "Dushambe", new District(1, "district", new Province(1, "province")), "Nicolas", leader, 4);
            group.OtherOrgAmount = 100;
            group.OtherOrgDebts = ERRORVALUE;

            services.SaveSolidarityGroup(ref group);
        }
Esempio n. 2
0
        public void TestUpdateGroup()
        {
            AddDataForTestingTransaction addDataForTesting = new AddDataForTestingTransaction();
            clientManagement = new ClientManager(DataUtil.TESTDB);
            clientServices = new ClientServices(clientManagement);

            DeleteAllData();

            Person leader = addDataForTesting.AddPerson();
            Person members = addDataForTesting.AddPersonBis();
            Person membersTer = addDataForTesting.AddPersonTer();
            Person membersQuater = addDataForTesting.AddPersonQuater();
            Group group = new Group
                              {
                                  Active = true,
                                  City = "Dushambe",
                                  District = leader.District,
                                  LoanCycle = 2,
                                  Name = "SCG",
                                  Leader =new Member{Tiers = leader,LoanShareAmount = 1000,CurrentlyIn = true,IsLeader = true,JoinedDate = TimeProvider.Today},
                                  Branch = _branch
                              };

            group.AddMember(new Member { Tiers = members, LoanShareAmount = 200, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersTer, LoanShareAmount = 400, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersQuater, LoanShareAmount = 700, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });

            Assert.AreEqual(String.Empty, clientServices.SaveSolidarityGroup(ref group));

            group.Name = "SCG2";
            Assert.AreEqual(String.Empty, clientServices.SaveSolidarityGroup(ref group));
        }
Esempio n. 3
0
        public void TestSaveGroupWhenNoEnoughMembers()
        {
            ApplicationSettings dataParam = GetDataBaseParam(4, true);

            ClientServices services = new ClientServices(dataParam);
            Member leader = new Member {Tiers = {Id = 1}};
            Group group = AddGroup(true, "Dushambe", new District(1, "district", new Province(1, "province")), "Nicolas", leader, 0);

            services.SaveSolidarityGroup(ref group);
        }
Esempio n. 4
0
        public void TestSaveGroupWhenLeaderIsNull()
        {
            ApplicationSettings dataParam = GetDataBaseParam(4, true);

            ClientServices services = new ClientServices(dataParam);
            Group group = AddGroup(true, "Dushambe", new District(1, "district", new Province(1, "province")), "Nicolas", null, 4);

            services.SaveSolidarityGroup(ref group);
        }
Esempio n. 5
0
        public void TestSaveGroupWhenGroupIsNull()
        {
            ApplicationSettings dataParam = ApplicationSettings.GetInstance("");
            dataParam = GetDataBaseParam(4, true);

            ClientServices services = new ClientServices(dataParam);
            Group group = null;

            services.SaveSolidarityGroup(ref group);
        }
Esempio n. 6
0
        public void TestSaveGroupWhenDistrictIsNull()
        {
            ApplicationSettings dataParam = GetDataBaseParam(4, true);

            ClientServices services = new ClientServices(dataParam);

            Member leader = new Member {Tiers = {Id = 1}};
            Group group = AddGroup(true, "Dushambe", null, "Nicolas", leader, 4);

            services.SaveSolidarityGroup(ref group);
        }
Esempio n. 7
0
        public void TestSaveGroupWhenCityIsNotMandatory()
        {
            AddDataForTestingTransaction addDataForTesting = new AddDataForTestingTransaction();
            clientManagement = new ClientManager(DataUtil.TESTDB);
            clientServices = new ClientServices(clientManagement);
            branchManager = new BranchManager(DataUtil.TESTDB);
            //List<Branch> branchs = branchManager.SelectAll();

            ApplicationSettings dataParam = ApplicationSettings.GetInstance("");
            dataParam.DeleteAllParameters();
            dataParam.AddParameter(OGeneralSettings.GROUPMINMEMBERS, 4);
            dataParam.AddParameter(OGeneralSettings.GROUPMAXMEMBERS, 10);
            dataParam.AddParameter(OGeneralSettings.CITYMANDATORY, false);
            DeleteAllData();

            Person leader = addDataForTesting.AddPerson();
            Person members = addDataForTesting.AddPersonBis();
            Person membersTer = addDataForTesting.AddPersonTer();
            Person membersQuater = addDataForTesting.AddPersonQuater();
            Group group = new Group
                              {
                                  Active = true,
                                  City = null,
                                  District = leader.District,
                                  Name = "SCG",
                                  Leader = new Member { Tiers = leader, LoanShareAmount = 1000, CurrentlyIn = true, IsLeader = true, JoinedDate = TimeProvider.Today },
                                  LoanCycle = 3,
                                  Branch = _branch
                              };

            group.AddMember(new Member { Tiers = members, LoanShareAmount = 200, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersTer, LoanShareAmount = 400, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });
            group.AddMember(new Member { Tiers = membersQuater, LoanShareAmount = 700, CurrentlyIn = true, IsLeader = false, JoinedDate = TimeProvider.Today });

            Assert.AreEqual(String.Empty, clientServices.SaveSolidarityGroup(ref group));
        }