예제 #1
0
        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);
        }
예제 #2
0
        public void GetMethodShouldReturnValue()
        {
            //arrange
            IRepository <MainTask> repository = new MainTaskRepository();

            //act
            var result = repository.Get();

            //assert
            Assert.IsNotNull(result);
        }