Exemplo n.º 1
0
        public void HouseHoldListingCreateNotPass()
        {
            //Arrange
            bool expected = false;
            //Act
            HouseHoldService hhs     = new HouseHoldService(hdao);
            HouseHold        request = new HouseHold(1000.00, "Testing address", 92868, false);

            int     newID  = hhs.CreateHouseHold(request);
            IResult result = hhs.CreateHouseHoldListing(newID + 1);
            bool    actual = result.IsSuccess;

            Console.WriteLine(result.Message);
            hhs.DeleteHouseHold(newID);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void HouseHoldCreateNotPassB()
        {
            //Arrange
            bool expected = false;
            bool actual   = false;
            //Act
            HouseHoldService hhs     = new HouseHoldService(hdao);
            HouseHold        request = new HouseHold(1000.00, "Testing address", 999999, false);
            int newID = hhs.CreateHouseHold(request);

            if (newID > 0)
            {
                actual = true;
            }
            Console.WriteLine("New HID is " + newID + " if is 0 then test pass\nCreateHouseHold will return 0 if this zip is not valid");
            hhs.DeleteHouseHold(newID);
            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void HouseHoldCreateNotPassA()
        {
            //Arrange
            bool expected = false;
            bool actual   = false;
            //Act
            HouseHoldService hhs     = new HouseHoldService(hdao);
            HouseHold        request = new HouseHold(1000.00, "Testing address", 92868, false);
            int newHouse1            = hhs.CreateHouseHold(request);
            int newHouse2            = hhs.CreateHouseHold(request);

            if (newHouse2 > 0)
            {
                actual = true;
            }
            Console.WriteLine("First HID is " + newHouse1);
            Console.WriteLine("Second HID is " + newHouse2 + " if is 0 then test pass\nCreateHouseHold will return 0 when this address is already used");
            hhs.DeleteHouseHold(newHouse1);
            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        //Delete HouseHoldListing first and then delete HouseHold
        public IResult DeleteHouseHold(int hID)
        {
            bool ifSuccess = houseHoldService.DeleteHouseHoldListing(hID);

            if (ifSuccess)
            {
                ifSuccess = houseHoldService.DeleteHouseHold(hID);

                if (ifSuccess)
                {
                    return(new CheckResult("Delete Successed!", true));
                }
                else
                {
                    return(new CheckResult("Delete Failed!", false));
                }
            }
            else
            {
                return(new CheckResult("Delete Failed! Cannot delete HouseHoldListing!", false));
            }
        }