private void AddListToDatabase() { string email = "*****@*****.**"; string password = "******"; _user = new User() { Email = email, FirstName = "Atanas", LastName = "Kambitov", Id = 1, IsAdmin = true, UniqueToken = _uniqueToken, Lists = new List <Backend.Models.Database.TodoList>(), Password = password }; _list = new Backend.Models.Database.TodoList() { Id = 1, Title = "ListOne", Items = new List <TodoItem>(), UserId = 1 }; _db.Users.Add(_user); _db.Lists.Add(_list); _db.SaveChanges(); }
public void List_Model_Test_Returns_No_Errors() { //Arrange Backend.Models.Database.TodoList list = new Backend.Models.Database.TodoList() { Id = 1, Items = new List <Backend.Models.Database.TodoItem>(), Title = "List One" }; //Act List <ValidationResult> lstErrors = ValidateModel(list); //Assert Assert.True(lstErrors.Count == 0); }
public void List_Model_Test_Returns_Title_Is_Required() { //Arrange Backend.Models.Database.TodoList list = new Backend.Models.Database.TodoList() { Id = 1, Items = new List <Backend.Models.Database.TodoItem>() }; //Act List <ValidationResult> lstErrors = ValidateModel(list); string result = lstErrors[0].ToString(); //Assert Assert.True(lstErrors.Count == 1); Assert.Equal("Title is required", result); }