Beispiel #1
0
            public void When_AliasHasEmailAddressDuplicated_ShouldNotThrow()
            {
                // arrange
                var authors = AuthorTestDataBuilder
                              .Create()
                              .WithAuthor("Travis Frisinger", "*****@*****.**")
                              .Build();
                var repoPath = AliasPath("duplicated-email-addresses.json");

                var sut = new Aliases(repoPath);
                // act
                Action action = () => sut.Map_To_Authors(authors);

                // assert
                action.Should().NotThrow <Exception>();
            }
Beispiel #2
0
            public void When_EmailAddressIsSharedByMultipleAliases_ShouldThrow()
            {
                // arrange
                var authors = AuthorTestDataBuilder
                              .Create()
                              .WithAuthor("Travis Frisinger", "*****@*****.**")
                              .Build();
                var repoPath = AliasPath("shared-email-addresses.json");

                var sut = new Aliases(repoPath);
                // act
                Action action = () => sut.Map_To_Authors(authors);

                // assert
                action.Should().Throw <Exception>()
                .WithMessage("Aliases can't share an email address.");
            }
Beispiel #3
0
            public void When_AliasFileNullOrWhitespace_ShouldReturnOriginalAuthor(string path)
            {
                // arrange
                var authors = AuthorTestDataBuilder
                              .Create()
                              .WithAuthor("Brendon Page", "*****@*****.**")
                              .Build();

                var sut = new Aliases(path);
                // act
                var actual = sut.Map_To_Authors(authors);
                // assert
                var expected = AuthorTestDataBuilder
                               .Create()
                               .WithAuthor("Brendon Page", "*****@*****.**")
                               .Build();

                actual.Should().BeEquivalentTo(expected);
            }
Beispiel #4
0
                public void When_AliasNameIsDifferentToRepositoryAuthor_ShouldUseAliasName()
                {
                    // arrange
                    var authors = AuthorTestDataBuilder
                                  .Create()
                                  .WithAuthor("Not Cake Face", "*****@*****.**")
                                  .Build();
                    var repoPath = AliasPath("many-unique-aliases.json");

                    var sut = new Aliases(repoPath);
                    // act
                    var actual = sut.Map_To_Authors(authors);
                    // assert
                    var expected = AuthorTestDataBuilder
                                   .Create()
                                   .WithAuthor("Cake Face", "*****@*****.**")
                                   .Build();

                    actual.Should().BeEquivalentTo(expected);
                }
Beispiel #5
0
                public void When_NoAdditionalEmailAddresses_ShouldReturnOriginalAuthor()
                {
                    // arrange
                    var authors = AuthorTestDataBuilder
                                  .Create()
                                  .WithAuthor("Cake Face", "*****@*****.**")
                                  .Build();
                    var repoPath = AliasPath("many-unique-aliases.json");

                    var sut = new Aliases(repoPath);
                    // act
                    var actual = sut.Map_To_Authors(authors);
                    // assert
                    var expected = AuthorTestDataBuilder
                                   .Create()
                                   .WithAuthor("Cake Face", "*****@*****.**")
                                   .Build();

                    actual.Should().BeEquivalentTo(expected);
                }
Beispiel #6
0
                public void When_AliasHasAdditionalEmailAddresses_ShouldReturnAuthorWithUnionOfEmailAddresses()
                {
                    // arrange
                    var authors = AuthorTestDataBuilder
                                  .Create()
                                  .WithAuthor("Brendon Page", "*****@*****.**")
                                  .Build();
                    var repoPath = AliasPath("many-unique-aliases.json");

                    var sut = new Aliases(repoPath);
                    // act
                    var actual = sut.Map_To_Authors(authors);
                    // assert
                    var expected = AuthorTestDataBuilder
                                   .Create()
                                   .WithAuthor("Brendon Page", "*****@*****.**", "*****@*****.**", "*****@*****.**")
                                   .Build();

                    actual.Should().BeEquivalentTo(expected);
                }
Beispiel #7
0
                public void When_AuthorHasAdditionalEmailAddresses_ShouldReturnAuthorWithUnionOfEmailAddresses()
                {
                    // arrange
                    var authors = AuthorTestDataBuilder
                                  .Create()
                                  .WithAuthor("Travis Frisinger", "*****@*****.**", "*****@*****.**")
                                  .Build();
                    var repoPath = TestRepoPath("many-unique-aliases.json");

                    var sut = new Aliases(repoPath);
                    // act
                    var actual = sut.Map_To_Authors(authors);
                    // assert
                    var expected = AuthorTestDataBuilder
                                   .Create()
                                   .WithAuthor("Travis Frisinger", "*****@*****.**", "*****@*****.**", "*****@*****.**")
                                   .Build();

                    actual.Should().BeEquivalentTo(expected);
                }