Exemplo n.º 1
0
        public void UpdateIdeaStatusTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };
            RestAPIAddIdeaStateResponse response = new RestAPIAddIdeaStateResponse();
            int IdeaId = 0;

            submitIdeaMock.Setup(x => x.InsertIdeaStatus(It.IsAny <RestAPIAddIdeaStateResponse>(), It.IsAny <int>(), It.IsAny <int>()));
            submitIdeaMock.Setup(x => x.GetAllStakeholdersEmailAdd(It.IsAny <int>())).Returns(new List <IdeaEmailToDetails>()
            {
                new IdeaEmailToDetails()
                {
                    EmailAddress = "*****@*****.**", IdeaState = 1
                }
            });
            queryUtilMock.Setup(x => x.GetAllStakeholdersEmailAdd(It.IsAny <IIdeaDatabaseDataContext>(), It.IsAny <int>())).Returns(new List <IdeaEmailToDetails>()
            {
                new IdeaEmailToDetails()
                {
                    EmailAddress = "*****@*****.**", IdeaState = 1
                }
            });

            response = apiController.UpdateIdeaStatus(IdeaId);

            Assert.IsTrue(response.ErrorList.Count == 0);
        }
Exemplo n.º 2
0
        public void InsertIdeaTest_OK()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            RestAPISubmitIdeaResponse response = new RestAPISubmitIdeaResponse()
            {
                ErrorList = new HashSet <Fault>()
                {
                    new Fault("Submit Idea", "", "")
                }
            };

            RestAPISubmitIdeaRequest request = new RestAPISubmitIdeaRequest()
            {
                Title            = "test",
                BusinessImpact   = "test",
                CategoryId       = 1,
                ChallengeId      = 1,
                Description      = "test",
                IdeaContributors = "test",
                IsDraft          = false,
                Solution         = "test"
            };

            ideaMock.Setup(x => x.SubmitIdeas(It.IsAny <RestAPISubmitIdeaResponse>(), It.IsAny <RestAPISubmitIdeaRequest>(), It.IsAny <int>())).Returns(response);
            response = apiController.InsertIdea(request);

            Assert.IsTrue(response.ErrorList.Count == 0);
        }
Exemplo n.º 3
0
        public void GetIdeaSponsorsListTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            Assert.IsNotNull(apiController.GetIdeaSponsorsList());
            submitIdeaMock.Verify(t => t.GetIdeaSponsorsList(It.IsAny <RestAPIGetUserIdeaStatusResponse>(), It.IsAny <int>()));
        }
Exemplo n.º 4
0
        public void SearchIdeaTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            string SearchText = "test";

            Assert.IsNotNull(apiController.SearchIdea(SearchText));
            submitIdeaMock.Verify(t => t.SearchIdea(It.IsAny <RestAPISearchIdeaResponse>(), It.IsAny <string>(), It.IsAny <int>()));
        }
Exemplo n.º 5
0
        public void GetDetailsTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            int IdeaId = 1;

            Assert.IsNotNull(apiController.GetDetails(IdeaId));
            submitIdeaMock.Verify(t => t.GetIdeasDetails(It.IsAny <RESTGetUserIdeaDetailsResponse>(), It.IsAny <int>()));
        }
Exemplo n.º 6
0
        public void DeleteIdeaCommentTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };
            RestAPIDeleteIdeaResponse response = new RestAPIDeleteIdeaResponse();
            int IdeaId = 1;

            Assert.IsNotNull(apiController.DeleteIdeaComment(IdeaId));
            submitIdeaMock.Verify(x => x.DeleteIdeaComment(It.IsAny <RestAPIDeleteIdeaResponse>(), It.IsAny <int>()));
        }
Exemplo n.º 7
0
        public void GetPublicListTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            int  CategoryId = 0;
            bool Sort       = false;

            Assert.IsNotNull(apiController.GetPublicList(CategoryId, Sort));
            submitIdeaMock.Verify(t => t.GetPublicIdeas(It.IsAny <RestAPIGetUserIdeaResponse>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>()));
        }
Exemplo n.º 8
0
        public void UpdateDetailsTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };
            RestAPIUpdateIdeaRequest request = new RestAPIUpdateIdeaRequest()
            {
                Title = "test"
            };

            int IdeaId = 1;

            Assert.IsNotNull(apiController.UpdateDetails(request, IdeaId));
            submitIdeaMock.Verify(t => t.UpdateIdea(It.IsAny <RestAPIUpdateIdeaResponse>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <RestAPIUpdateIdeaRequest>()));
        }
Exemplo n.º 9
0
        public void AddIdeaCommentReplyTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            RestAPIAddCommentReplyRequest request = new RestAPIAddCommentReplyRequest()
            {
                IdeaCommentID         = 1,
                DiscussionDescription = "test"
            };

            Assert.IsNotNull(apiController.AddIdeaCommentReply(request));
            submitIdeaMock.Verify(t => t.InsertCommentReply(It.IsAny <RestAPIAddCommentReplyResponse>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()));
        }
Exemplo n.º 10
0
        public void AddIdeaCommentTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };
            RestAPIAddUserCommentResponse response = new RestAPIAddUserCommentResponse();
            RestAPIAddUserCommentRequest  request  = new RestAPIAddUserCommentRequest()
            {
                IdeaID             = 1,
                CommentDescription = "test"
            };

            Assert.IsNotNull(apiController.AddIdeaComment(request));
            submitIdeaMock.Verify(x => x.InsertIdeaComment(It.IsAny <ResponseBase>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>()));
        }
Exemplo n.º 11
0
        public void UpdateSensitiveTest()
        {
            RESTAPIIdeaController apiController = new RESTAPIIdeaController()
            {
                DeviceWithDbContext = new RESTAPIDeviceWithDbContext()
                {
                    DbContext = new IdeaDatabase.DataContext.IdeaDatabaseDataContext()
                }
            };

            RestAPIUpdateSensitiveResponse response = new RestAPIUpdateSensitiveResponse();
            int  IdeaId      = 1;
            bool isSensitive = false;

            logMock.Setup(x => x.InsertIdeaLog(It.IsAny <ResponseBase>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>()));
            submitIdeaMock.Setup(x => x.UpdateSensitive(It.IsAny <ResponseBase>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>()));
            response = apiController.UpdateSensitive(IdeaId, isSensitive);

            Assert.IsTrue(response.ErrorList.Count == 0);
        }