コード例 #1
0
        public void InsertTaTutorErrorTest()
        {
            //// Arrange
            var errors = new List<string>();
            var mockRepository = new Mock<ITaTutorRepository>();
            var tatutorService = new TaTutorService(mockRepository.Object);

            //// Act
            tatutorService.InsertTaTutor(null, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
コード例 #2
0
        public void InsertTaTutorBadId()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<ITaTutorRepository>();
            var tatutorService = new TaTutorService(mockRepository.Object);
            var tatutor = new TaTutor { TaTutorId = "A012_3456", FirstName = "Jane", LastName = "Doe" };

            //// Act
            tatutorService.InsertTaTutor(tatutor, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
コード例 #3
0
        public void GetTaTutorListTest()
        {
            //// Arrange
            var errors = new List<string>();
            var mockRepository = new Mock<ITaTutorRepository>();
            var tatutorService = new TaTutorService(mockRepository.Object);
            var tatutorList = new List<TaTutor>();
            tatutorList.Add(new TaTutor { TaTutorId = "A0123456", FirstName = "Tony", LastName = "Stark" });
            tatutorList.Add(new TaTutor { TaTutorId = "A0987655", FirstName = "John", LastName = "Smith" });
            mockRepository.Setup(x => x.GetTutorList(ref errors)).Returns(tatutorList);

            //// Act
            var otherList = tatutorService.GetTutorList(ref errors);

            //// Assert
            Assert.AreEqual(tatutorList, otherList);
        }
コード例 #4
0
        public void UpdateTaTutorErrorTest2()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<ITaTutorRepository>();
            var tatutorService = new TaTutorService(mockRepository.Object);
            var tatutor = new TaTutor { TaTutorId = string.Empty };

            //// Act
            tatutorService.UpdateTaTutor(tatutor, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }