public void OpretLobby_PostRedirectToActionUserLogged_on_RedirectsToLobby() { // Arrange var mockUserSession = new Mock <IUserSession>(); mockUserSession.Setup(x => x.User).Returns(_savedUser); ILobby MockedLobby = new Lobby(_savedUser.Username); MockedLobby.Id = _lobbyViewModel.Id; var mockLobbyProxy = new Mock <ILobbyProxy>(); mockLobbyProxy .Setup(x => x.CreateInstanceAsync(_lobbyViewModel.Id, _savedUser.Username, _savedUser.Password)) .Returns(Task.FromResult(MockedLobby)); var sut = new LobbyController(FakeSwagCommunication, mockLobbyProxy.Object, mockUserSession.Object); // Act var result = (RedirectToActionResult)sut.OpretLobby(_lobbyViewModel); //Assert Assert.AreEqual("Lobby", result.ActionName); }
public void OpretLobby_GoToOpretLobby_ReturnsCorrectViewName() { // Arrange var mockUserSession = new Mock <IUserSession>(); mockUserSession.Setup(x => x.User).Returns(_savedUser); var sut = new LobbyController(FakeSwagCommunication, FakeSwagLobby, mockUserSession.Object); // Act var result = sut.OpretLobby() as ViewResult; // Assert Assert.AreEqual("OpretLobby", result.ViewName); }