public void CreateGameroomContentVerification() { //Arrange var mock = new Mock <IRepository>(MockBehavior.Strict); string roomname = "bla"; string gamename = "tic-tac-toe"; TTTColour colour = TTTColour.Circle; CreateGameroomCommand command = new CreateGameroomCommand() { Roomname = roomname, Gamename = gamename, Colour = colour }; mock.Setup(repo => repo.Insert(It.IsAny <Gameroom>())); GameroomController target = new GameroomController(mock.Object); //Act target.Create(command); //Assert mock.Verify(repo => repo.Insert(It.Is <Gameroom>( input => input.Roomname == roomname && input.Gamename == gamename && input.Colour == colour) ), Times.Once() ); }
public ActionResult Create(CreateGameroomCommand command) { Gameroom room = new Gameroom(_repo); room.Create(command.Roomname, command.Gamename, command.Colour); return(View()); }
public void CreateAnyGameroom() { //Arrange var mock = new Mock <IRepository>(MockBehavior.Strict); mock.Setup(room => room.Insert(It.IsAny <Gameroom>())); GameroomController target = new GameroomController(mock.Object); CreateGameroomCommand command = new CreateGameroomCommand(); //Act target.Create(command); //Assert mock.Verify(room => room.Insert(It.IsAny <Gameroom>())); }