public void Register_IncorrectInput_ReturnesMessage(string email, string password, string confirmPass, string message) { //Arange Mock <IRepository> mokedRepository = new Mock <IRepository>(); mokedRepository.Setup(funk => funk.GetAllUsers()).Returns(GetSampleUsers()); GuestMenu guestMenu = new GuestMenu(mokedRepository.Object, new TestConsoleWrapper(new List <string>() { email, password, confirmPass })); var expected = message; //Act string actual = guestMenu.Register(); //Assert Assert.Equal(expected, actual); }
public void Register_ValidInput_NotifiesSubscribers() { //Arange Mock <IRepository> mokedRepository = new Mock <IRepository>(); bool Registered = false; mokedRepository.Setup(funk => funk.GetAllUsers()).Returns(GetSampleUsers()); mokedRepository.Setup(funk => funk.AddUser("*****@*****.**", "pass")).Returns(new User()); GuestMenu guestMenu = new GuestMenu(mokedRepository.Object, new TestConsoleWrapper(new List <string>() { "*****@*****.**", "pass", "pass" })); guestMenu.NotifyOfLogginIn += (user) => Registered = true; //Act guestMenu.Register(); //Assert Assert.True(Registered); }