Exemplo n.º 1
0
        public void SetName_WhenFullNameHasOnlyValueForSurname_AssertSurnameIsSetToValue()
        {
            IPersonName sut = CreateSut();

            string surname = _fixture.Create <string>().Replace(" ", string.Empty);

            sut.SetName(surname);

            Assert.That(sut.Surname, Is.EqualTo(surname));
        }
Exemplo n.º 2
0
        public void SetName_WhenFullNameHasValueForGivenNameAndSurname_AssertGivenNameIsExtractedAndSet()
        {
            IPersonName sut = CreateSut();

            string givenName = _fixture.Create <string>().Replace(" ", string.Empty);
            string surname   = _fixture.Create <string>().Replace(" ", string.Empty);

            sut.SetName($"{givenName} {surname}");

            Assert.That(sut.GivenName, Is.EqualTo(givenName));
        }
Exemplo n.º 3
0
        public void SetName_WhenFullNameHasValueForGivenNameAndSurname_AssertMiddleNameIsSetToNull()
        {
            IPersonName sut = CreateSut();

            string givenName = _fixture.Create <string>().Replace(" ", string.Empty);
            string surname   = _fixture.Create <string>().Replace(" ", string.Empty);

            sut.SetName($"{givenName} {surname}");

            Assert.That(sut.MiddleName, Is.Null);
        }
Exemplo n.º 4
0
        public void SetName_WhenFullNameIsWhiteSpace_ThrowsArgumentNullException()
        {
            IPersonName sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.SetName(" "));

            Assert.That(result.ParamName, Is.EqualTo("fullName"));
        }