public void GivenValidUserWhenTaskCreatedWithNullDescriptionExceptionIsThrown() { // Arrange. var validUser = new User("*****@*****.**"); // Act. validUser.CreateTask(null); }
public void GivenNullDescriptionWhenTaskConstructedExceptionIsThrown() { // Arrange. var validUser = new User("*****@*****.**"); // Act. new Task(null, validUser); }
public void GivenInvalidEmailAddressWhenUserIsCreatedExceptionIsThrown() { // Arrange. var invalidEmailAddress = "invalidemailaddress"; // Act. var user = new User(invalidEmailAddress); }
public void GivenValidUserWhenTaskCreatedWithEmptyStringDescriptionExceptionIsThrown() { // Arrange. var validUser = new User("*****@*****.**"); // Act. validUser.CreateTask(string.Empty); }
/// <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; }
public void GivenValidUserWhenTaskCreatedUserIsAssignedToCreatedByProperty() { // Arrange. var validUser = new User("*****@*****.**"); // Act. var task = validUser.CreateTask("Pick up milk."); // Assert. Assert.AreEqual(validUser, task.CreatedBy); }
public void GivenValidUserWhenTaskCreatedIsAddedToUserTasksList() { // Arrange. var validUser = new User("*****@*****.**"); // Act. var task = validUser.CreateTask("Pick up milk."); // Assert. Assert.IsTrue(validUser.Tasks.Contains(task)); }
public void GivenValidEmailAddressWhenUserIsCreatedEmailAddressIsAssigned() { // Arrange. var validEmailAddress = "*****@*****.**"; // Act. var user = new User(validEmailAddress); // Assert. Assert.AreEqual(validEmailAddress, user.EmailAddress); }
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); }
public void GivenNullAsEmailAddressWhenUserIsCreatedExceptionIsThrown() { // Act. var user = new User(null); }
public void GivenEmptyStringAsEmailAddressWhenUserIsCreatedExceptionIsThrown() { // Act. var user = new User(string.Empty); }