# 4.การใช้ Theory และ InlineData

💬 หลังจากที่ได้ลอง xUnit กันไปบ้างละ คราวนี้เราลองมาดูการใช้ xUnit ให้คล่องขึ้นโดยใช้สิ่งที่เรียกว่า **Theory** และ **InlineData** กันบ้างดีกว่า เพื่อให้เราใส่ตัวอย่างลงไปได้ง่ายขึ้น

{% embed url="<https://www.youtube.com/watch?v=32Z2x7tTuHo&list=PLUjAn8nwWniiL3ToFK8PfmAo8U6IoGAkg&index=4>" %}

## 🎯 สรุปสั้นๆ

### 👨‍🚀 Theory

ใช้สำหรับกรณีที่มันมีอยู่เคสเดียว และส่วนใหญ่จะเป็นกรณีที่เราคาดหลังว่ามันทำงานถูกต้องอยู่แล้ว

### 👨‍🚀 InlineData

ใช้สำหรับกรณีที่มันมีเคสอยู่หลายๆแบบ แต่โค้ดที่ใช้ทำงานเหมือนกับทุกแบบ


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.saladpuk.com/software-testing/tdd101/xunit02.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
