public void TestMethod_MapSkillsToAssociate_Exception() { var _mockDashboardProvider = new Mock <IDashboardProvider>(); _mockDashboardProvider .Setup(s => s.DeleteAssociateSkillMapping(It.IsAny <int>())) .Throws(new Exception("Mock Unit Test Exception")); this._associateController = new AssociatesController(null, null, null, null, null, _mockDashboardProvider.Object); //// Mao Skills to Associate var mapResponse = this._associateController.MapSkillsToAssociate(-4, new List <AssociateSkill> { new AssociateSkill { AssociateId = -4, SkillId = 1, Rating = 10 }, new AssociateSkill { AssociateId = -4, SkillId = 1, Rating = 20 } }); Assert.IsNotNull(mapResponse); var mapResult = mapResponse as InternalServerErrorResult; Assert.IsNotNull(mapResult); }
public AssociatesController GetController() { _controller = GetInstance <AssociatesController>(); _controller.Request = new HttpRequestMessage(); _controller.Request.SetConfiguration(new HttpConfiguration()); return(_controller); }
public void TestMethod_GetMappedSkillsOfAssociate_Exception() { var _mockDashboardProvider = new Mock <IDashboardProvider>(); _mockDashboardProvider .Setup(s => s.GetAssociateSkillMap(It.IsAny <int>())) .Throws(new Exception("Mock Unit Test Exception")); this._associateController = new AssociatesController(null, null, null, null, null, _mockDashboardProvider.Object); var getAllResponse = this._associateController.GetMappedSkillsOfAssociate(123456); Assert.IsNotNull(getAllResponse); var getAllResult = getAllResponse as InternalServerErrorResult; Assert.IsNotNull(getAllResult); }
public void TestMethod_DeleteAssociate_NotFound() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.GetAssociate(It.IsAny <int>(), It.IsAny <Boolean>())) .Returns(() => { return(null); }); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); var delResponse = this._associateController.DeleteAssociate(-1); Assert.IsNotNull(delResponse); var delResult = delResponse as NotFoundResult; Assert.IsNotNull(delResult); }
public void TestMethod_GetAllAssociates_Exception() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.GetAssociates()) .Throws(new Exception("Mock Unit Test Exception")); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); var getAllResponse = this._associateController.GetAssociates(); Assert.IsNotNull(getAllResponse); var getAllResult = getAllResponse as InternalServerErrorResult; Assert.IsNotNull(getAllResult); }
public void TestMethod_PostAssociate_Failure() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.AddAssociate(It.IsAny <Associate>())) .Returns(() => { return(0); }); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); Associate associate = new Associate { Id = -1, Name = "UnitTest_PostAssociate_Failure", Email = "*****@*****.**", Mobile = "+1 11111111", Picture = "", Status = "Green", Level = 1, Remark = "Top performer", Strength = "Coding", Weakness = "Team Building", Gender = "M", IsFresher = false, OtherSkill = "CSR Related Works" }; var postResponse = this._associateController.PostAssociate(associate); Assert.IsNotNull(postResponse); var postResult = postResponse as InternalServerErrorResult; Assert.IsNotNull(postResult); }
public void TestMethod_DeleteAssociate_Exception() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.GetAssociate(It.IsAny <int>(), It.IsAny <Boolean>())) .Returns(() => { return(new Associate()); }); _mockAssociateProvider .Setup(s => s.DeleteAssociate(It.IsAny <Associate>())) .Throws(new Exception("Mock Unit Test Exception")); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); var delResponse = this._associateController.DeleteAssociate(-1); Assert.IsNotNull(delResponse); var delResult = delResponse as InternalServerErrorResult; Assert.IsNotNull(delResult); }
public void TestMethod_PutAssociate_NotFound() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.GetAssociate(It.IsAny <int>(), It.IsAny <Boolean>())) .Returns(() => { return(null); }); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); var assocToUpdate = new Associate { Id = 123, Name = "UnitTest_PutAssociate_NotFound" }; var putResponse = this._associateController.PutAssociate(assocToUpdate); Assert.IsNotNull(putResponse); var putResult = putResponse as NotFoundResult; Assert.IsNotNull(putResult); }
public void TestMethod_PutAssociate_Exception() { var _mockAssociateProvider = new Mock <IAssociateProvider>(); _mockAssociateProvider .Setup(s => s.GetAssociate(It.IsAny <int>(), It.IsAny <Boolean>())) .Returns(() => { return(new Associate()); }); _mockAssociateProvider .Setup(s => s.EditAssociate(It.IsAny <Associate>())) .Throws(new Exception("Mock Unit Test Exception")); this._associateController = new AssociatesController(null, null, null, _mockAssociateProvider.Object, null, null); var assocToUpdate = new Associate { Id = 123, Name = "UnitTest_PutAssociate_Exception" }; var putResponse = this._associateController.PutAssociate(assocToUpdate); Assert.IsNotNull(putResponse); var putResult = putResponse as InternalServerErrorResult; Assert.IsNotNull(putResult); }
public void setup() { associatesController = new AssociatesController(); }
public TestInitializer() { this._skillController = new SkillsController(); this._associatesController = new AssociatesController(); }
public void TestCleanUp() { _controller = null; }
public void TestInit() { _controller = GetController(); }
public AssociatesControllerMockTest() { this._skillController = new SkillsController(); this._associateController = new AssociatesController(); }
public void Setup(BenchmarkContext context) { _assocController = new AssociatesController(); _associateIdList = new List <int>(); }