Skip to content

Commit 46a5ede

Browse files
committed
#283 Adding WithoutTempDataBuilder implementation.
1 parent 0a9d4fe commit 46a5ede

3 files changed

Lines changed: 17 additions & 22 deletions

File tree

src/MyTested.AspNetCore.Mvc.TempData/Builders/Contracts/Data/IWithoutTempDataBuilder.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ namespace MyTested.AspNetCore.Mvc.Builders.Contracts.Data
44
{
55
public interface IWithoutTempDataBuilder
66
{
7-
IAndWithoutTempDataBuilder WithEntry(string key, object value);
7+
IAndWithoutTempDataBuilder WithoutEntry(string key);
88

9-
IAndWithoutTempDataBuilder WithEntries(IDictionary<string, object> entries);
10-
11-
IAndWithoutTempDataBuilder WithEntries(object entries);
9+
IAndWithoutTempDataBuilder WithoutEntries(IEnumerable<string> entriesKeys);
1210

1311
IAndWithoutTempDataBuilder WithoutAllEntries();
1412
}

src/MyTested.AspNetCore.Mvc.TempData/Builders/Data/WithTempDataBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Microsoft.AspNetCore.Mvc.ViewFeatures;
66
using Microsoft.AspNetCore.Routing;
77
using Utilities.Extensions;
8-
using Utilities.Validators;
98

109
/// <summary>
1110
/// Used for building mocked <see cref="ITempDataDictionary"/>.
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-

2-
namespace MyTested.AspNetCore.Mvc.Builders.Data
1+
namespace MyTested.AspNetCore.Mvc.Builders.Data
32
{
4-
using System;
53
using System.Collections.Generic;
64
using Microsoft.AspNetCore.Mvc.ViewFeatures;
75
using MyTested.AspNetCore.Mvc.Builders.Contracts.Data;
@@ -13,29 +11,29 @@ public WithoutTempDataBuilder(ITempDataDictionary tempData)
1311
{
1412
}
1513

16-
public IWithoutTempDataBuilder AndAlso()
17-
{
18-
throw new NotImplementedException();
19-
}
20-
21-
public IAndWithoutTempDataBuilder WithEntries(IDictionary<string, object> entries)
14+
public IAndWithoutTempDataBuilder WithoutEntries(IEnumerable<string> entriesKeys)
2215
{
23-
throw new NotImplementedException();
24-
}
16+
foreach (var key in entriesKeys)
17+
{
18+
this.WithoutEntry(key);
19+
}
2520

26-
public IAndWithoutTempDataBuilder WithEntries(object entries)
27-
{
28-
throw new NotImplementedException();
21+
return this;
2922
}
3023

31-
public IAndWithoutTempDataBuilder WithEntry(string key, object value)
24+
public IAndWithoutTempDataBuilder WithoutEntry(string key)
3225
{
33-
throw new NotImplementedException();
26+
this.TempData.Remove(key);
27+
return this;
3428
}
3529

3630
public IAndWithoutTempDataBuilder WithoutAllEntries()
3731
{
38-
throw new NotImplementedException();
32+
this.TempData.Clear();
33+
return this;
3934
}
35+
36+
public IWithoutTempDataBuilder AndAlso()
37+
=> this;
4038
}
4139
}

0 commit comments

Comments
 (0)