Skip to content

Commit 4f6e046

Browse files
committed
updated refactoring task
1 parent 704038b commit 4f6e046

3 files changed

Lines changed: 465 additions & 209 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
2+
=== COMPLEX SCENARIO 1 ===
3+
User: Premium membership, 8 years, Lifetime: $120000
4+
First-time: False, Student: False, Employee: True
5+
Corporate: False, Subscription: True
6+
Order: 21 items, Total: $13400.00
7+
Event: BlackFriday, Payment: BankTransfer, Express: True
8+
Pre-order: True, Bulk: True, Gift Wrap: False
9+
Region: PremiumZone
10+
Electronics: $6550.00, Clothing: $2950.00, Accessories: $3900.00
11+
Coupon: FLASHSALE25 (percent, 25%, Valid: True, Expired: False)
12+
--- COMPLEX PRICING CALCULATION ---
13+
Base Total: $13400.00
14+
Applied Discounts: Premium membership (15%), Ultra high-value bonus (10%), Premium seasonal bonus (8%), Premium-enhanced coupon FLASHSALE25 (32.5%), Black Friday premium coupon boost (5%), Major bulk purchase (8%)
15+
Total Discount: 78.5% (Electronics capped at 15%)
16+
Shipping Cost: $35.00
17+
Final Price: $8801.00
18+
============================================================
19+
20+
=== COMPLEX SCENARIO 2 ===
21+
User: Gold membership, 3 years, Lifetime: $8000
22+
First-time: False, Student: False, Employee: True
23+
Corporate: False, Subscription: False
24+
Order: 21 items, Total: $13400.00
25+
Event: BlackFriday, Payment: BankTransfer, Express: True
26+
Pre-order: True, Bulk: True, Gift Wrap: False
27+
Region: PremiumZone
28+
Electronics: $6550.00, Clothing: $2950.00, Accessories: $3900.00
29+
Coupon: SAVE15 (percent, 15%, Valid: True, Expired: False)
30+
--- COMPLEX PRICING CALCULATION ---
31+
Base Total: $13400.00
32+
Applied Discounts: Gold membership (12%), Gold seasonal bonus (6%), Gold bulk bonus (4%), Category diversity bonus (3%), Employee gold discount (10%), Pre-order employee bonus (5%), Alternative payment bonus (3%), Gold-enhanced coupon SAVE15 (18.0%), Major bulk purchase (8%)
33+
Total Discount: 69.0% (Electronics capped at 15%)
34+
Shipping Cost: $35.00
35+
Final Price: $9171.50
36+
============================================================
37+
38+
=== COMPLEX SCENARIO 3 ===
39+
User: Silver membership, 1 years, Lifetime: $1500
40+
First-time: False, Student: True, Employee: False
41+
Corporate: False, Subscription: False
42+
Order: 10 items, Total: $2495.00
43+
Event: BackToSchool, Payment: PayPal, Express: True
44+
Pre-order: False, Bulk: False, Gift Wrap: True
45+
Region: Domestic
46+
Electronics: $2400.00, Clothing: $0.00, Accessories: $95.00
47+
Coupon: SAVE15 (percent, 15%, Valid: True, Expired: False)
48+
--- COMPLEX PRICING CALCULATION ---
49+
Base Total: $2495.00
50+
Applied Discounts: Silver membership (8%), Student silver bonus (5%), Back-to-school bonus (7%), Student bulk discount (4%), Student tech focus bonus (6%), Gift presentation bonus (2%), Express education bonus (3%), Coupon SAVE15 (15%), Bulk purchase (5%)
51+
Total Discount: 55.0% (Electronics capped at 15%)
52+
Shipping Cost: $10.00
53+
Final Price: $2092.75
54+
============================================================
55+
56+
=== COMPLEX SCENARIO 4 ===
57+
User: Guest membership, 0 years, Lifetime: $0
58+
First-time: True, Student: False, Employee: False
59+
Corporate: False, Subscription: False
60+
Order: 6 items, Total: $1160.00
61+
Event: NewYear, Payment: CreditCard, Express: True
62+
Pre-order: False, Bulk: False, Gift Wrap: False
63+
Region: PremiumZone
64+
Electronics: $1110.00, Clothing: $0.00, Accessories: $50.00
65+
Coupon: FLASHSALE25 (percent, 25%, Valid: True, Expired: False)
66+
--- COMPLEX PRICING CALCULATION ---
67+
Base Total: $1160.00
68+
Applied Discounts: First-time buyer (10%), Seasonal welcome bonus (5%), First-order volume bonus (4%), Premium payment newcomer bonus (3%), High-value newcomer bonus (6%), Premium zone newcomer bonus (4%), Express shipping trial bonus (3%), Coupon FLASHSALE25 (25%)
69+
Total Discount: 60.0% (Electronics capped at 15%)
70+
Shipping Cost: $35.00
71+
Final Price: $998.50
72+
============================================================
73+
74+
=== COMPLEX SCENARIO 5 ===
75+
User: Premium membership, 8 years, Lifetime: $120000
76+
First-time: False, Student: False, Employee: True
77+
Corporate: False, Subscription: True
78+
Order: 21 items, Total: $13400.00
79+
Event: BlackFriday, Payment: BankTransfer, Express: True
80+
Pre-order: True, Bulk: True, Gift Wrap: False
81+
Region: PremiumZone
82+
Electronics: $6550.00, Clothing: $2950.00, Accessories: $3900.00
83+
Coupon: EXPIRED20 (percent, 20%, Valid: False, Expired: True)
84+
--- COMPLEX PRICING CALCULATION ---
85+
Coupon expired. No discount applied.
86+
Base Total: $13400.00
87+
Applied Discounts: Premium membership (15%), Ultra high-value bonus (10%), Premium seasonal bonus (8%), Coupon EXPIRED20 expired - no discount, Major bulk purchase (8%)
88+
Total Discount: 41.0% (Electronics capped at 15%)
89+
Shipping Cost: $35.00
90+
Final Price: $10263.50
91+
============================================================
92+
93+
=== COMPLEX SCENARIO 6 ===
94+
User: Gold membership, 3 years, Lifetime: $8000
95+
First-time: False, Student: False, Employee: True
96+
Corporate: False, Subscription: False
97+
Order: 21 items, Total: $13400.00
98+
Event: BlackFriday, Payment: BankTransfer, Express: True
99+
Pre-order: True, Bulk: True, Gift Wrap: False
100+
Region: PremiumZone
101+
Electronics: $6550.00, Clothing: $2950.00, Accessories: $3900.00
102+
Coupon: None
103+
--- COMPLEX PRICING CALCULATION ---
104+
Base Total: $13400.00
105+
Applied Discounts: Gold membership (12%), Gold seasonal bonus (6%), Gold bulk bonus (4%), Category diversity bonus (3%), Employee gold discount (10%), Pre-order employee bonus (5%), Alternative payment bonus (3%), Major bulk purchase (8%)
106+
Total Discount: 51.0% (Electronics capped at 15%)
107+
Shipping Cost: $35.00
108+
Final Price: $9873.50
109+
============================================================
110+
111+
=== SECURITY TESTING ===
112+
113+
--- Test 1: Null User Protection ---
114+
Exception thrown: 'System.ArgumentNullException' in ECommercePricingEngine.dll
115+
✓ Security measure working: User cannot be null (Parameter 'user')
116+
117+
--- Test 2: Null Order Protection ---
118+
Exception thrown: 'System.ArgumentNullException' in ECommercePricingEngine.dll
119+
✓ Security measure working: Order cannot be null (Parameter 'order')
120+
121+
--- Test 3: Invalid Order Data (Negative Prices) ---
122+
Testing with negative price item...
123+
Error: Invalid order data detected. Pricing calculation aborted.
124+
125+
--- Test 4: Empty Order ---
126+
Testing with empty order...
127+
Error: Invalid order data detected. Pricing calculation aborted.
128+
129+
--- Test 5: Extreme Coupon Value Protection ---
130+
Testing with 99% coupon (should be capped at 50%)...
131+
Base Total: $100.00
132+
Applied Discounts: Silver membership (8%), Coupon EXTREME99 (50%)
133+
Total Discount: 58.0% (Electronics capped at 15%)
134+
Shipping Cost: $10.00
135+
Final Price: $95.00
136+
137+
=== SECURITY TESTING COMPLETE ===
138+
139+
The program '[34928] ECommercePricingEngine.exe' has exited with code 0 (0x0).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
=== Loan Approval Workflow Test Results ===
2+
3+
Applicant 1:
4+
Credit Score: 780
5+
Annual Income: $120,000
6+
Verified Income: $118,000
7+
Employment: Salaried (8 years)
8+
Debt-to-Income Ratio: 25.0%
9+
Requested Amount: $400,000
10+
Property Value: $500,000
11+
Down Payment: $100,000
12+
Liquid Assets: $25,000
13+
Credit History: 12 years
14+
Loan Purpose: HomePurchase
15+
Property Type: PrimaryResidence
16+
Veteran: False
17+
First-Time Homebuyer: False
18+
19+
RESULT:
20+
Status: Approved
21+
Interest Rate: 3.25%
22+
Approved Amount: $400,000
23+
Notes: Prime borrower approved at best available rate.
24+
------------------------------------------------------------
25+
26+
Applicant 2:
27+
Credit Score: 760
28+
Annual Income: $150,000
29+
Verified Income: $145,000
30+
Employment: Salaried (6 years)
31+
Debt-to-Income Ratio: 32.0%
32+
Requested Amount: $320,000
33+
Property Value: $400,000
34+
Down Payment: $80,000
35+
Liquid Assets: $15,000
36+
Credit History: 10 years
37+
Loan Purpose: HomePurchase
38+
Property Type: SecondHome
39+
Veteran: False
40+
First-Time Homebuyer: False
41+
42+
RESULT:
43+
Status: Approved
44+
Interest Rate: 3.75%
45+
Approved Amount: $320,000
46+
Notes: Approved for second home with rate premium.
47+
------------------------------------------------------------
48+
49+
Applicant 3:
50+
Credit Score: 680
51+
Annual Income: $75,000
52+
Verified Income: $73,000
53+
Employment: Salaried (4 years)
54+
Debt-to-Income Ratio: 38.0%
55+
Requested Amount: $280,000
56+
Property Value: $280,000
57+
Down Payment: $0
58+
Liquid Assets: $12,000
59+
Credit History: 8 years
60+
Loan Purpose: HomePurchase
61+
Property Type: PrimaryResidence
62+
Veteran: True
63+
First-Time Homebuyer: False
64+
65+
RESULT:
66+
Status: Approved
67+
Interest Rate: 3.5%
68+
Approved Amount: $280,000
69+
Notes: VA loan approved with government backing.
70+
------------------------------------------------------------
71+
72+
Applicant 4:
73+
Credit Score: 750
74+
Annual Income: $95,000
75+
Verified Income: $85,000
76+
Employment: SelfEmployed (3 years)
77+
Debt-to-Income Ratio: 30.0%
78+
Requested Amount: $350,000
79+
Property Value: $450,000
80+
Down Payment: $100,000
81+
Liquid Assets: $20,000
82+
Credit History: 9 years
83+
Loan Purpose: HomePurchase
84+
Property Type: PrimaryResidence
85+
Veteran: False
86+
First-Time Homebuyer: False
87+
88+
RESULT:
89+
Status: ConditionallyApproved
90+
Interest Rate: 4.5%
91+
Approved Amount: $340,000
92+
Notes: Conditional approval pending income re-verification.
93+
------------------------------------------------------------
94+
95+
Applicant 5:
96+
Credit Score: 640
97+
Annual Income: $65,000
98+
Verified Income: $64,000
99+
Employment: Salaried (3 years)
100+
Debt-to-Income Ratio: 40.0%
101+
Requested Amount: $240,000
102+
Property Value: $250,000
103+
Down Payment: $10,000
104+
Liquid Assets: $8,000
105+
Credit History: 6 years
106+
Loan Purpose: HomePurchase
107+
Property Type: PrimaryResidence
108+
Veteran: False
109+
First-Time Homebuyer: True
110+
111+
RESULT:
112+
Status: Approved
113+
Interest Rate: 4%
114+
Approved Amount: $240,000
115+
Notes: FHA loan approved for first-time homebuyer.
116+
------------------------------------------------------------
117+
118+
Applicant 6:
119+
Credit Score: 650
120+
Annual Income: $80,000
121+
Verified Income: $79,000
122+
Employment: Salaried (5 years)
123+
Debt-to-Income Ratio: 35.0%
124+
Requested Amount: $200,000
125+
Property Value: $250,000
126+
Down Payment: $50,000
127+
Liquid Assets: $15,000
128+
Credit History: 4 years
129+
Loan Purpose: HomePurchase
130+
Property Type: PrimaryResidence
131+
Veteran: True
132+
First-Time Homebuyer: False
133+
134+
RESULT:
135+
Status: Approved
136+
Interest Rate: 5%
137+
Approved Amount: $180,000
138+
Notes: Approved with rate premium due to bankruptcy history.
139+
------------------------------------------------------------
140+
141+
Applicant 7:
142+
Credit Score: 720
143+
Annual Income: $90,000
144+
Verified Income: $88,000
145+
Employment: Salaried (4 years)
146+
Debt-to-Income Ratio: 48.0%
147+
Requested Amount: $300,000
148+
Property Value: $380,000
149+
Down Payment: $80,000
150+
Liquid Assets: $12,000
151+
Credit History: 8 years
152+
Loan Purpose: Refinance
153+
Property Type: PrimaryResidence
154+
Veteran: False
155+
First-Time Homebuyer: False
156+
157+
RESULT:
158+
Status: Declined
159+
Interest Rate: 0%
160+
Approved Amount: $0
161+
Notes: Declined due to credit score and debt ratio combination.
162+
------------------------------------------------------------
163+
164+
Applicant 8:
165+
Credit Score: 580
166+
Annual Income: $55,000
167+
Verified Income: $54,000
168+
Employment: Salaried (2 years)
169+
Debt-to-Income Ratio: 42.0%
170+
Requested Amount: $180,000
171+
Property Value: $200,000
172+
Down Payment: $20,000
173+
Liquid Assets: $5,000
174+
Credit History: 3 years
175+
Loan Purpose: HomePurchase
176+
Property Type: PrimaryResidence
177+
Veteran: False
178+
First-Time Homebuyer: True
179+
180+
RESULT:
181+
Status: Declined
182+
Interest Rate: 0%
183+
Approved Amount: $0
184+
Notes: Declined due to credit score below minimum lending standards.
185+
------------------------------------------------------------
186+
187+
188+
=== LOAN APPROVAL SECURITY TESTING ===
189+
190+
--- Test 1: Null Applicant Protection ---
191+
√ Security measure working: Applicant cannot be null (Parameter 'applicant')
192+
193+
--- Test 2: Invalid Credit Score Bounds ---
194+
Testing with credit score of 900 (above valid range)...
195+
Result: Declined - Application declined due to invalid or incomplete financial data
196+
197+
--- Test 3: Negative Financial Values ---
198+
Testing with negative annual income...
199+
Result: Declined - Application declined due to invalid or incomplete financial data
200+
201+
--- Test 4: Extreme Loan Amount ---
202+
Testing with $100M loan request (above reasonable limits)...
203+
Result: Declined - Application declined due to invalid or incomplete financial data
204+
205+
--- Test 5: Invalid Debt-to-Income Ratio ---
206+
Testing with 150% debt-to-income ratio...
207+
Result: Declined - Application declined due to invalid or incomplete financial data
208+
209+
--- Test 6: Down Payment Exceeding Property Value ---
210+
Testing with down payment exceeding property value...
211+
Result: Declined - Application declined due to invalid or incomplete financial data
212+
213+
--- Test 7: Extreme Employment Years ---
214+
Testing with 75 years of employment...
215+
Result: Declined - Application declined due to invalid or incomplete financial data
216+
217+
--- Test 8: Valid Applicant (Security Baseline) ---
218+
Testing with valid applicant data...
219+
Result: Declined - Rate: 0% - Amount: $0
220+
Notes: Declined due to credit score and debt ratio combination.
221+
222+
--- Test 9: Zero Property Value (Division Protection) ---
223+
Testing with zero property value (tests safe division)...
224+
Result: Declined - Application declined due to invalid or incomplete financial data
225+
226+
=== LOAN APPROVAL SECURITY TESTING COMPLETE ===

0 commit comments

Comments
 (0)