Skip to content

Commit

Permalink
Fix unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dicky authored and dicky committed Jun 30, 2020
1 parent 8e9b197 commit a2e0466
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions UnitTests/ExampleSimpleListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@ public ExampleSimpleListTest()
await Task.Delay(10);
_mockData.Remove(_mockData.First(x => x.Id == id));
})
.Setup(x => x.GetAll(It.IsAny<int>())).Returns(() =>
{
return _mockData.AsEnumerable();
})
.Setup(x => x.Get(It.IsAny<int>())).Returns((int id) =>
{
return _mockData.FirstOrDefault(x => x.Id == id);
})
.Setup(x => x.Add(It.IsAny<Employee>())).Returns(() =>
{
return 3;
})
.Setup(x => x.Update(It.IsAny<Employee>())).Calls((Employee update) =>
{
var data = _mockData.First(x => x.Id == update.Id);
data.FirstName = update.FirstName;
data.LastName = update.LastName;
})
.Setup(x => x.Remove(It.IsAny<int>())).Calls((int id) =>
{
_mockData.Remove(_mockData.First(x => x.Id == id));
})
.Object;

_hubEmulator = new HubEmulatorBuilder()
Expand Down

0 comments on commit a2e0466

Please sign in to comment.