You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Implement in-memory caching for frequently used data, especially for Blazor Server apps. Use IMemoryCache for lightweight caching solutions.
46
+
- Implement in-memory caching for frequently used data, especially for Blazor Server apps. Use IMemoryCache for
47
+
lightweight caching solutions.
46
48
- For Blazor WebAssembly, utilize localStorage or sessionStorage to cache application state between user sessions.
47
-
- Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state across multiple users or clients.
48
-
- Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user experience.
49
+
- Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state
50
+
across multiple users or clients.
51
+
- Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user
52
+
experience.
49
53
50
54
## State Management Libraries
51
55
52
56
- Use Blazor's built-in Cascading Parameters and EventCallbacks for basic state sharing across components.
53
-
- Implement advanced state management solutions using libraries like Fluxor or BlazorState when the application grows in complexity.
54
-
- For client-side state persistence in Blazor WebAssembly, consider using Blazored.LocalStorage or Blazored.SessionStorage to maintain state between page reloads.
55
-
- For server-side Blazor, use Scoped Services and the StateContainer pattern to manage state within user sessions while minimizing re-renders.
57
+
- Implement advanced state management solutions using libraries like Fluxor or BlazorState when the application grows in
58
+
complexity.
59
+
- For client-side state persistence in Blazor WebAssembly, consider using Blazored.LocalStorage or
60
+
Blazored.SessionStorage to maintain state between page reloads.
61
+
- For server-side Blazor, use Scoped Services and the StateContainer pattern to manage state within user sessions while
Copy file name to clipboardExpand all lines: .github/prompts/xunit.prompt.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,8 @@ description: 'Get best practices for XUnit unit testing, including data-driven t
6
6
7
7
# XUnit Best Practices
8
8
9
-
Your goal is to help me write effective unit tests with XUnit.V3, covering both standard and data-driven testing approaches.
9
+
Your goal is to help me write effective unit tests with XUnit.V3, covering both standard and data-driven testing
10
+
approaches.
10
11
11
12
## Project Setup
12
13
@@ -48,7 +49,8 @@ Your goal is to help me write effective unit tests with XUnit.V3, covering both
48
49
49
50
## Assertions
50
51
51
-
- Use the `Shouldly` NuGet package for more readable assertions. Only use the xUnit built-in assertions when Shouldly does not provide the needed functionality.
52
+
- Use the `Shouldly` NuGet package for more readable assertions. Only use the xUnit built-in assertions when Shouldly
53
+
does not provide the needed functionality.
52
54
- Use `Assert.Equal` for value equality
53
55
- Use `Assert.Same` for reference equality
54
56
- Use `Assert.True`/`Assert.False` for boolean conditions
0 commit comments