예제 #1
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));
        }
예제 #2
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));
        }
예제 #3
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));
        }
예제 #4
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));
        }