public void FindByAssigneeInt_NotFound_Arraysize0() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; string description3 = "Promenera"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 3 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); todoItems.AddToDoItem(null, description3); //act Todo[] foundItemsArray = todoItems.FindByAssignee(personId + 10); //assert Assert.Empty(foundItemsArray); }
public void FindByAssigneePerson_NullPerson_ReturnsUnassignedItems() { //findbyAssignee(null) will return the unassigned items //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee1 = new Person(personId, firstName, familyName); personId = PersonSequencer.nextPersonId(); Person assignee2 = new Person(personId, "Klara", familyName); Person assignee3 = null; string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; string description3 = "Promenera"; //TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 3 items todoItems.AddToDoItem(assignee1, description1); todoItems.AddToDoItem(assignee2, description2); todoItems.AddToDoItem(assignee3, description3); //act Todo[] foundItemsArray = todoItems.FindByAssignee(assignee3); //assert Assert.Single(foundItemsArray); }
public void FindByDoneStatus_FindOnlyNotDone_Arraysize3() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; string description3 = "Promenera"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 3 not done todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); todoItems.AddToDoItem(assignee, description3); //set one of the items to done. Todo itemToBeDone = todoItems.FindById(1); itemToBeDone.Done = true; //act Todo[] foundItemsArray = todoItems.FindByDoneStatus(false); //assert Assert.Equal(2, foundItemsArray.Length); }
public void FindAllItems_FindsAll_CorrectArraySize() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Peter"; string familyName = "Jansson"; Person assignee = new Person(personId, firstName, familyName); int expectedSizeOfToDoItems = 3; string description1 = "Vattna blommor"; string description2 = "Dammsuga"; string description3 = "Putsa fönster"; TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 3 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); todoItems.AddToDoItem(null, description3); //act Todo[] itemArray = todoItems.FindAll(); //assert Assert.Equal(expectedSizeOfToDoItems, itemArray.Length); }
public void FindItemById_UnknownId_NoneReturned() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 2 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); int size = todoItems.Size(); //act Todo foundItem = todoItems.FindById(size + 3); //assert Assert.Null(foundItem); }
public void FindUnassigned_FindOnlyOne_Arraysize3() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; string description3 = "Promenera"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 4 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(null, description1); todoItems.AddToDoItem(null, description2); todoItems.AddToDoItem(null, description3); //act Todo[] foundItemsArray = todoItems.FindUnassignedTodoItems(); //assert Assert.Equal(3, foundItemsArray.Length); Assert.Equal(description1, foundItemsArray[0].Description); }
public void FindItemById_FindOne_CorrectDescription() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 2 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); int size = todoItems.Size(); //act Todo foundLastItem = todoItems.FindById(size); Todo foundFirstItem = todoItems.FindById(1); //assert Assert.Equal(description2, foundLastItem.Description); Assert.Equal(description1, foundFirstItem.Description); }
public void FindByDoneStatus_FindOnlyOne_Arraysize1() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Fredrik"; string familyName = "Persson"; Person assignee = new Person(personId, firstName, familyName); string description1 = "Gå ut med hunden"; string description2 = "Kela med katten"; TodoSequencer.reset(); TodoItems todoItems = new TodoItems(); todoItems.Clear(); //add 2 items todoItems.AddToDoItem(assignee, description1); todoItems.AddToDoItem(assignee, description2); //set one item to done. Todo itemToBeDone = todoItems.FindById(1); itemToBeDone.Done = true; //act Todo[] foundItemsArray = todoItems.FindByDoneStatus(true); //assert Assert.Single(foundItemsArray); Assert.Equal(description1, foundItemsArray[0].Description); }
public void TestPersonSequencer() { //Arrange int expectedNesxpersonId = 1; Assert.Equal(expectedNesxpersonId, PersonSequencer.nextPersonId()); PersonSequencer.reset(); Assert.Equal(0, PersonSequencer.getPersonId()); //Assert }
public void NextPersonId_StepupId_Increase() { //Arrange int expectedId = 1; PersonSequencer.reset(); //Act int getId = PersonSequencer.nextPersonId(); // Assert Assert.Equal(expectedId, getId); }
public void nextPersonIdTest_TestThatPersonIdIsIncrementedAndReturned() { //Arrange int expected = 1; PersonSequencer.reset(); //Act int result = PersonSequencer.nextPersonId(); //Assert Assert.Equal(expected, result); }
public void PersonIDTest2() { //Arrange int expectedPersonIdValue = 0; //this variable is used to set what should be the expected outcome of the test int actualPersonIDValue = 0; //this variable is used to contain the value that is actually getting calculated by the method //Act actualPersonIDValue = PersonSequencer.nextPersonId(); expectedPersonIdValue++; //Assert Assert.Equal(expectedPersonIdValue, actualPersonIDValue); }
public void PersonIDTest3() { //Arrange int expectedPersonIDValue = 0; int actualPersonIDValue = 0; //Act PersonSequencer.reset(); // reset the personid value to 0 actualPersonIDValue = PersonSequencer.nextPersonId(); // again increment by 1 expectedPersonIDValue++; // expected value set to 1 //Assert Assert.Equal(expectedPersonIDValue, actualPersonIDValue); }
public void resetTest_TestThatPersonIdIsResetToZero() { //Arrange int expected = 1; PersonSequencer.reset(); //Act PersonSequencer.nextPersonId(); PersonSequencer.nextPersonId(); PersonSequencer.nextPersonId(); PersonSequencer.reset(); //Assert Assert.Equal(expected, PersonSequencer.nextPersonId()); }
public void PersonResetTest() { // Arrange int expected = 1; PersonSequencer.nextPersonId(); int num = PersonSequencer.nextPersonId(); //tests reset Method PersonSequencer.Reset(); int actual = PersonSequencer.nextPersonId(); // Assert Assert.Equal(expected, actual); Assert.True(num >= 2);//Assert control number }
public void PersonSequencerTest() { // Arrange int expected = 1; int expected2 = 2; // Act PersonSequencer.Reset();// resets sequencer to always get expected results int actual = PersonSequencer.nextPersonId(); int actual2 = PersonSequencer.nextPersonId(); // Assert // Asserts nextPersonId Assert.Equal(expected, actual); Assert.Equal(expected2, actual2); }
public void AddTodoItem_WithAssignee_SizeAndDescriptionCorrect() { //arrange int personId = PersonSequencer.nextPersonId(); string firstName = "Anna"; string familyName = "Jansson"; Person assignee = new Person(personId, firstName, familyName); int expectedSizeOfToDoItems = 1; string description = "Tvätta bilen"; TodoItems todoItems = new TodoItems(); //act Todo addedTodo = todoItems.AddToDoItem(assignee, description); //assert Assert.Equal(expectedSizeOfToDoItems, todoItems.Size()); Assert.Equal(description, addedTodo.Description); }