public void AddMethodShouldAddEntity() { //arrange IRepository <MainTask> mainTaskRepository = new MainTaskRepository(); IRepository <User> userRepository = new UserRepository(); //act var intialCountMainTask = mainTaskRepository.Get().ToList().Count; User user = userRepository.GetById(1); MainTask mainTask = new MainTask { Name = "plyaing", Date = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy")), StartTime = DateTime.Parse(DateTime.Now.ToString("HH tt")), EndTime = DateTime.Parse(DateTime.Today.ToString("HH tt")), Priority = PriorityType.LOW, User = user }; mainTaskRepository.Add(mainTask); user.MainTasks.Add(mainTask); var afterCountMainTask = mainTaskRepository.Get().ToList().Count; //assert Assert.IsTrue(afterCountMainTask > intialCountMainTask); }
public void GetMethodShouldReturnValue() { //arrange IRepository <MainTask> repository = new MainTaskRepository(); //act var result = repository.Get(); //assert Assert.IsNotNull(result); }