예제 #1
0
        public void GivenValidUserWhenTaskCreatedWithNullDescriptionExceptionIsThrown()
        {
            // Arrange.
            var validUser = new User("*****@*****.**");

            // Act.
            validUser.CreateTask(null);
        }
예제 #2
0
        public void GivenNullDescriptionWhenTaskConstructedExceptionIsThrown()
        {
            // Arrange.
            var validUser = new User("*****@*****.**");

            // Act.
            new Task(null, validUser);
        }
예제 #3
0
        public void GivenInvalidEmailAddressWhenUserIsCreatedExceptionIsThrown()
        {
            // Arrange.
            var invalidEmailAddress = "invalidemailaddress";

            // Act.
            var user = new User(invalidEmailAddress);
        }
예제 #4
0
        public void GivenValidUserWhenTaskCreatedWithEmptyStringDescriptionExceptionIsThrown()
        {
            // Arrange.
            var validUser = new User("*****@*****.**");

            // Act.
            validUser.CreateTask(string.Empty);
        }
예제 #5
0
        /// <summary>
        /// Constructor is used internally within the domain model to create a task with a specific user as the creator.
        /// </summary>
        /// <param name="description">A brief description of the task.</param>
        /// <param name="creator">The creator of the task.</param>
        internal Task(string description, User creator)
        {
            description.ThrowIfNullOrEmpty();
            Description = description;

            creator.ThrowIfNull();
            CreatedBy = creator;
            AssignedTo = creator;
            ModifiedBy = creator;
        }
예제 #6
0
        public void GivenValidUserWhenTaskCreatedUserIsAssignedToCreatedByProperty()
        {
            // Arrange.
            var validUser = new User("*****@*****.**");

            // Act.
            var task = validUser.CreateTask("Pick up milk.");

            // Assert.
            Assert.AreEqual(validUser, task.CreatedBy);
        }
예제 #7
0
        public void GivenValidUserWhenTaskCreatedIsAddedToUserTasksList()
        {
            // Arrange.
            var validUser = new User("*****@*****.**");

            // Act.
            var task = validUser.CreateTask("Pick up milk.");

            // Assert.
            Assert.IsTrue(validUser.Tasks.Contains(task));
        }
예제 #8
0
        public void GivenValidEmailAddressWhenUserIsCreatedEmailAddressIsAssigned()
        {
            // Arrange.
            var validEmailAddress = "*****@*****.**";

            // Act.
            var user = new User(validEmailAddress);

            // Assert.
            Assert.AreEqual(validEmailAddress, user.EmailAddress);
        }
예제 #9
0
        public void GivenValidUserAndDescriptionThenDescriptionSetCorrectly()
        {
            // Arrange.
            var validDescription = "Pick up milk.";
            var validUser = new User("*****@*****.**");

            // Act.
            var task = new Task(validDescription, validUser);

            // Assert.
            Assert.AreEqual(validDescription, task.Description);
        }
예제 #10
0
 public void GivenNullAsEmailAddressWhenUserIsCreatedExceptionIsThrown()
 {
     // Act.
     var user = new User(null);
 }
예제 #11
0
 public void GivenEmptyStringAsEmailAddressWhenUserIsCreatedExceptionIsThrown()
 {
     // Act.
     var user = new User(string.Empty);
 }