예제 #1
0
        public void FindAllTest()
        {
            //Arrange
            TodoSequencer.ResetID();
            ToDoItems toDo = new ToDoItems();

            toDo.AddNewToDo(1, "Win the lotto");
            toDo.AddNewToDo(2, "Learn to code");

            //Act
            ToDo[] result = toDo.FindAll();

            //Assert
            Assert.True(result.Length == 2);
        }
예제 #2
0
        public void RemoveToDoObjectTest()
        {
            //Arrange
            ToDoItems toDo = new ToDoItems();

            TodoSequencer.ResetID();
            int result       = 1;
            int idToDoRemove = 2;

            ToDo toDo1 = toDo.AddNewToDo(1, "Learn to code");
            ToDo toDo2 = toDo.AddNewToDo(2, "Get a job");

            //Act
            toDo.RemoveToDoObject(idToDoRemove);
            int size = toDo.Size();

            ToDo[] remaining = toDo.FindAll();

            //Assert
            Assert.Equal(result, size);
            Assert.Contains(toDo1, remaining);
            Assert.DoesNotContain(toDo2, remaining);
        }
예제 #3
0
        public void AddNewItemToArrayTest()
        {
            //Arrange
            ToDoItems toDoItems   = new ToDoItems();
            string    description = "Learn to code";
            int       toDoId      = 1;

            //Act
            toDoItems.ClearToDo();
            TodoSequencer.ResetID();
            ToDo result = toDoItems.AddNewToDo(toDoId, description);

            //Assert
            Assert.NotNull(result);
            Assert.Contains(toDoId.ToString(), result.ToDoInformation());
            Assert.Contains(description, result.ToDoInformation());
        }
예제 #4
0
        public void FindSizeTest()
        {
            //Arrange
            ToDoItems toDoItems = new ToDoItems();
            int       size      = 1;
            int       toDoId    = 1;

            PersonSequencer.Reset();
            string toDo = "Learn to code";

            toDoItems.AddNewToDo(toDoId, toDo);

            //Act
            int result = toDoItems.Size();

            //Assert
            Assert.Equal(size, result);
        }
예제 #5
0
        public void FindByIDTest() //Test to find if it finds the ID
        {
            //Arrange
            ToDoItems toDoItems   = new ToDoItems();
            int       toDoId      = 1;
            string    description = "Learn to code";

            PersonSequencer.Reset();

            toDoItems.AddNewToDo(toDoId, description);

            //Act
            ToDo result = toDoItems.FindToDoById(toDoId);

            //Assert
            Assert.Contains(toDoId.ToString(), result.ToDoInformation());
            Assert.Contains(description, result.ToDoInformation());
        }