コード例 #1
0
        public void Backlog_Service_GetAll_Method_should_return_productbacklog_type_object()
        {
            //Arrange
            List <UserStory> requests = new List <UserStory>();
            var request = new UserStory();

            request.StoryId = 1;
            requests.Add(request);
            var mockRepoReq = new Mock <IBacklogRepository>();     //mocking RequestRepository

            mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests); //mocking GetAll() of RequestRepository
            BacklogService obj = new BacklogService(mockRepoReq.Object);
            //Act
            var res = obj.GetAll(1);

            //Assert
            Assert.IsType <List <UserStory> >(res);
        }
コード例 #2
0
        public void Backlog_Service_GetAll_Method_To_GetAll_Request()
        {
            //Arrange
            List <UserStory> requests = new List <UserStory>();
            var request = new UserStory();

            request.StoryId = 1;
            requests.Add(request);
            var mockRepoReq = new Mock <IBacklogRepository>();     //mocking RequestRepository

            mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests); //mocking GetAll() of RequestRepository
            BacklogService obj = new BacklogService(mockRepoReq.Object);
            //Act
            var res = obj.GetAll(1);

            //Assert
            Assert.NotNull(res);
            Assert.Equal(requests, res);
        }