public void Create_CallsRepositoryAdd() { // Register a lobby with the mock. var lobby = new Lobby() { Bets = new List <Bet>() }; LobbyRepository.Get(Arg.Any <long>()).Returns(lobby); // Assert that we hit the repository. BetRepository.DidNotReceive().Add(Arg.Any <Bet>()); MyWork.DidNotReceive().Complete(); var viewModel = new CreateBetViewModel() { BuyIn = "0", Description = "Description", LobbyID = 0, StartDate = DateTime.Now.ToLongDateString(), StopDate = DateTime.Now.ToLongDateString(), Title = "Name" }; uut.Create(viewModel); Assert.That(uut.ModelState.IsValid); // Assert that we hit the repository. BetRepository.Received(1).Add(Arg.Any <Bet>()); MyWork.Received(1).Complete(); }
public void Show_CallsRepositoryGet() { // Register a bet with the mock. var bet = new Bet(); BetRepository.Get(Arg.Any <long>()).Returns(bet); // Assert that we hit the repository. BetRepository.DidNotReceive().Get(Arg.Any <long>()); uut.Show(0); // Assert that we hit the repository. BetRepository.Received(1).Get(Arg.Any <long>()); }