diff --git a/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IModelStateBuilder.cs b/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IModelStateBuilder.cs index 9a8fcd9e2..2517d8eea 100644 --- a/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IModelStateBuilder.cs +++ b/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IModelStateBuilder.cs @@ -1,5 +1,6 @@ namespace MyTested.AspNetCore.Mvc.Builders.Contracts.Models { + using System; using System.Collections.Generic; /// @@ -28,5 +29,19 @@ public interface IModelStateBuilder /// Model state entries as anonymous object. /// IAndModelStateBuilder WithErrors(object errors); + + /// + /// Tests whether the model state entry passes the given assertions. + /// + /// Action containing all assertions for the model state entry. + /// The same . + IAndModelStateBuilder Passing(Action assertions); + + /// + /// Tests whether the data provider entry passes the given predicate. + /// + /// Predicate testing the data provider entry. + /// The same . + IAndModelStateBuilder Passing(Func predicate); } } diff --git a/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/ModelStateBuilder.cs b/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/ModelStateBuilder.cs index 8b361ecd4..117baadea 100644 --- a/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/ModelStateBuilder.cs +++ b/src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/ModelStateBuilder.cs @@ -6,6 +6,7 @@ using Contracts.Models; using Internal.TestContexts; using Utilities.Extensions; + using System; /// /// Used for building @@ -54,5 +55,17 @@ public IAndModelStateBuilder WithErrors(object errors) private void AddError(string key, string errorMessage) => this.ModelState.AddModelError(key, errorMessage); + + /// + public IAndModelStateBuilder Passing(Action assertions) + { + throw new NotImplementedException(); + } + + /// + public IAndModelStateBuilder Passing(Func predicate) + { + throw new NotImplementedException(); + } } } diff --git a/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Contracts/Data/IViewBagTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Contracts/Data/IViewBagTestBuilder.cs index e093fbc75..7688ca97a 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Contracts/Data/IViewBagTestBuilder.cs +++ b/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Contracts/Data/IViewBagTestBuilder.cs @@ -66,5 +66,20 @@ public interface IViewBagTestBuilder /// Dictionary of view bag entries. /// The same . IAndViewBagTestBuilder ContainingEntries(IDictionary entries); + + + /// + /// Tests whether the view bag entry passes the given assertions. + /// + /// Action containing all assertions for the view bag entry. + /// The same . + IAndViewBagTestBuilder Passing(Action assertions); + + /// + /// Tests whether the view bag entry passes the given predicate. + /// + /// Predicate testing the view bag entry. + /// The same . + IAndViewBagTestBuilder Passing(Func< bool> predicate); } } diff --git a/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Data/ViewBagTestBuilder.cs b/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Data/ViewBagTestBuilder.cs index c5ec877ac..129888f0c 100644 --- a/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Data/ViewBagTestBuilder.cs +++ b/src/MyTested.AspNetCore.Mvc.ViewData/Builders/Data/ViewBagTestBuilder.cs @@ -1,5 +1,6 @@ namespace MyTested.AspNetCore.Mvc.Builders.Data { + using System; using System.Collections.Generic; using Contracts.Data; using Internal.TestContexts; @@ -32,10 +33,23 @@ public ViewBagTestBuilder(ComponentTestContext testContext) /// public IViewBagTestBuilder AndAlso() => this; + /// + public IAndViewBagTestBuilder Passing(Action assertions) + { + throw new NotImplementedException(); + } + + /// + public IAndViewBagTestBuilder Passing(Func predicate) + { + throw new NotImplementedException(); + } + /// /// When overridden in derived class provides a way to built the data provider as . /// /// Data provider as protected override IDictionary GetDataProvider() => this.testContext.GetViewData(); + } }