Esempio n. 1
0
        public void ToPerson_InvalidString()
        {
            //Arrange
            var systemUnderTest = new PersonParser();

            //Act/Assert
            Assert.Throws(typeof(PeopleParsingException), () => { systemUnderTest.ToPerson(k_personStringInvalidMissingComma); });
            Assert.Throws(typeof(PeopleParsingException), () => { systemUnderTest.ToPerson(k_personStringInvalidNoBool); });
        }
Esempio n. 2
0
        public void ToPersonValidTest()
        {
            //Arrange
            var mockPerson  = new Mock <IPerson>();
            var mockFactory = new Mock <IPersonFactory>();

            mockFactory.Setup(mock => mock.CreatePerson(k_personName, k_personAddress, k_personPhone, k_personIsActive)).Returns(mockPerson.Object).Verifiable();
            var systemUnderTest = new PersonParser(mockFactory.Object);

            //Act
            IPerson result = systemUnderTest.ToPerson(k_personString);

            //Assert
            Assert.AreEqual(mockPerson.Object, result);
            mockFactory.Verify(mock => mock.CreatePerson(k_personName, k_personAddress, k_personPhone, k_personIsActive), Times.Once);
        }