public void Throw_ArgumentNullException_When_PersonDontExist() { //Arrange var personListMock = new Mock <IPersonsCollection>(); var wIMTeamMock = new Mock <IWIMTeams>(); var sut = new Getters(personListMock.Object, wIMTeamMock.Object); //Act&&Assert var ex = Assert.ThrowsException <ArgumentNullException>(() => sut.GetPerson("Some Member")); Assert.AreEqual(string.Format(CommandsConsts.NoPersonFound, "Some Member"), ex.ParamName); }
public void CorrectlyPassData() { //Arrange var wIMTeamMock = new Mock <IWIMTeams>(); var personListMock = new Mock <IPersonsCollection>(); personListMock.Setup(x => x.Contains("Pesho")).Returns(true); personListMock.SetupGet(p => p["Pesho"]).Returns(new Mock <IPerson>().Object); var sut = new Getters(personListMock.Object, wIMTeamMock.Object); //Act var getPerson = sut.GetPerson("Pesho"); //Assert personListMock.Verify(x => x.Contains("Pesho"), Times.Once); personListMock.Verify(p => p["Pesho"], Times.Once); }