Skip to content

Commit

Permalink
Fixed WallController tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksanderis committed Feb 9, 2020
1 parent bbe097c commit 754a6cf
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Shrooms.Domain.Services.Notifications;
using Shrooms.Domain.Services.Permissions;
using Shrooms.Domain.Services.Wall;
using Shrooms.EntityModels.Models.Multiwall;
using Shrooms.UnitTests.ModelMappings;
using Shrooms.WebViewModels.Models.User;
using Shrooms.WebViewModels.Models.Wall;
Expand All @@ -38,6 +39,7 @@ public void TestInitializer()
_wallService = Substitute.For<IWallService>();
_notificationService = Substitute.For<INotificationService>();
var permissionService = Substitute.For<IPermissionService>();
permissionService.UserHasPermission(Arg.Any<UserAndOrganizationDTO>(), Arg.Any<string>()).Returns(true);

_wallController = new WallController(ModelMapper.Create(), _wallService, _notificationService, permissionService);
_wallController.ControllerContext = Substitute.For<HttpControllerContext>();
Expand Down Expand Up @@ -65,12 +67,12 @@ public async Task Wall_GetWall_List_Should_Return_View_Model()
Description = "Description",
IsFollowing = false
}
};
};

_wallService.GetWallsList(null, WallsListFilter.All).ReturnsForAnyArgs(Task.Run(() => walls));

var response = await _wallController.GetWallList(WallsListFilter.All);

Assert.IsInstanceOf<OkNegotiatedContentResult<IEnumerable<WallListViewModel>>>(response);
}

Expand All @@ -93,6 +95,7 @@ public async Task Wall_GetWall_Should_Return_View_Model()
Id = wallId
};

_wallService.GetWall(wallId, null).Returns(new WallDto { Type = WallType.UserCreated });
_wallService.GetWallDetails(0, null).ReturnsForAnyArgs(Task.Run(() => wall));

var response = await _wallController.GetWall(wallId);
Expand Down Expand Up @@ -178,6 +181,7 @@ public async Task Wall_GetPagedWall_Should_Return_View_Model()
}
};

_wallService.GetWall(wallId, null).Returns(new WallDto { Type = WallType.UserCreated });
_wallService.GetWallPosts(page, ConstWebApi.DefaultPageSize, null, wallId).ReturnsForAnyArgs(Task.Run(() => posts));

var response = await _wallController.GetPagedWall(wallId, page);
Expand Down

0 comments on commit 754a6cf

Please sign in to comment.