示例#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);
 }