Skip to content

Commit 2b0d307

Browse files
committed
Added OfType methods to BaseDataProviderTestBuilder (#148)
1 parent 66587b5 commit 2b0d307

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/MyTested.AspNetCore.Mvc.Abstractions/Builders/Data/BaseDataProviderTestBuilder.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace MyTested.AspNetCore.Mvc.Builders.Data
22
{
3+
using System;
34
using System.Collections.Generic;
45
using Base;
56
using Exceptions;
@@ -79,11 +80,20 @@ protected void ValidateContainingEntryWithValue<TValue>(TValue value)
7980
value,
8081
this.ThrowNewDataProviderAssertionException);
8182

83+
/// <summary>
84+
/// Validates whether the data provider contains entry value with the given type.
85+
/// </summary>
86+
protected void ValidateContainingEntryOfType(Type valueType)
87+
=> DictionaryValidator.ValidateValueOfType(
88+
this.DataProviderName,
89+
this.DataProvider,
90+
this.ThrowNewDataProviderAssertionException,valueType);
91+
8292
/// <summary>
8393
/// Validates whether the data provider contains entry value with the given type.
8494
/// </summary>
8595
/// <typeparam name="TValue">Type of the value.</typeparam>
86-
protected void ValidateContainingEntryOfType<TValue>()
96+
protected void ValidateContainingEntryOfType<TValue>()
8797
=> DictionaryValidator.ValidateValueOfType<TValue>(
8898
this.DataProviderName,
8999
this.DataProvider,
@@ -101,6 +111,18 @@ protected void ValidateContainingEntryOfType<TValue>(string key)
101111
key,
102112
this.ThrowNewDataProviderAssertionException);
103113

114+
/// <summary>
115+
/// Validates whether the data provider contains entry value with the given type and corresponding key.
116+
/// </summary>
117+
/// <param name="key"></param>
118+
/// <param name="valueType"></param>
119+
protected void ValidateContainingEntryOfType(string key, Type valueType)
120+
=> DictionaryValidator.ValidateStringKeyAndValueOfType(
121+
this.DataProviderName,
122+
this.DataProvider,
123+
key,
124+
this.ThrowNewDataProviderAssertionException,valueType);
125+
104126
/// <summary>
105127
/// Validates whether the data provider contains entry with the given key and corresponding value.
106128
/// </summary>

0 commit comments

Comments
 (0)