-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathViewBagTestBuilder.cs
More file actions
55 lines (46 loc) · 1.95 KB
/
ViewBagTestBuilder.cs
File metadata and controls
55 lines (46 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace MyTested.AspNetCore.Mvc.Builders.Data
{
using System;
using System.Collections.Generic;
using Contracts.Data;
using Internal.TestContexts;
/// <summary>
/// Used for testing dynamic view bag.
/// </summary>
public class ViewBagTestBuilder : BaseDataProviderWithStringKeyTestBuilder<IAndViewBagTestBuilder>, IAndViewBagTestBuilder
{
internal const string ViewBagName = "view bag";
private readonly ComponentTestContext testContext;
/// <summary>
/// Initializes a new instance of the <see cref="ViewBagTestBuilder"/> class.
/// </summary>
/// <param name="testContext"><see cref="ComponentTestContext"/> containing data about the currently executed assertion chain.</param>
public ViewBagTestBuilder(ComponentTestContext testContext)
: base(testContext, ViewBagName)
{
this.testContext = testContext;
}
/// <summary>
/// Gets the data provider test builder.
/// </summary>
/// <value>Test builder of <see cref="IAndViewBagTestBuilder"/>.</value>
protected override IAndViewBagTestBuilder DataProviderTestBuilder => this;
/// <inheritdoc />
public IViewBagTestBuilder AndAlso() => this;
/// <inheritdoc />
public IAndViewBagTestBuilder Passing(Action assertions)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public IAndViewBagTestBuilder Passing(Func<bool> predicate)
{
throw new NotImplementedException();
}
/// <summary>
/// When overridden in derived class provides a way to built the data provider as <see cref="IDictionary{TKey,TValue}"/>.
/// </summary>
/// <returns>Data provider as <see cref="IDictionary{TKey,TValue}"/></returns>
protected override IDictionary<string, object> GetDataProvider() => this.testContext.GetViewData();
}
}