Example #1
0
        public void GiveAnNewlyCreatedNote_WhenGettingEmailAddress_ThenValueShouldBeSameAsPassedInConstructor()
        {
            // arrange
            Note subject =
                new NoteBuilder()
                    .WithEmailAddress(new EmailAddress("*****@*****.**"))
                    .Build();

            // act
            EmailAddress result = subject.EmailAddress;

            // assert
            result.Should().Be(new EmailAddress("*****@*****.**"));
        }
Example #2
0
        public void GiveAnNewlyCreatedNote_WhenGettingTitle_ThenValueShouldBeSameAsPassedInConstructor()
        {
            // arrange
            Note subject =
                new NoteBuilder()
                    .WithTitle("title")
                    .Build();

            // act
            string result = subject.Title;

            // assert
            result.Should().Be("title");
        }
Example #3
0
        public void GiveAnNewlyCreatedNote_WhenGettingCreatingDate_ThenValueShouldBeAroundConstructionTime()
        {
            // arrange
            DateTime before = DateTime.Now;
            Note subject =
                new NoteBuilder()
                    .WithTitle("title")
                    .Build();
            DateTime after = DateTime.Now;

            // act
            DateTime result = subject.CreationDateTime;

            // assert
            result.
                Should().BeOnOrAfter(before)
                .And.BeOnOrBefore(after);
        }
Example #4
0
        public void WhenCreatingAnNewNoteWithNullForMessage_ThenShouldThrowArgumentNullException()
        {
            // arrange
            NoteBuilder subjectBuilder =
                new NoteBuilder()
                    .WithMessage(null);

            // act
            Action act = () => subjectBuilder.Build();

            // assert
            act.ShouldThrow<ArgumentNullException>();
        }