public void GetById_EmptyRequest_BadRequest() { var restClientMock = new Mock <IRestClient>(); var appiumRepositoryMock = new Mock <IRepository <AppiumProcess> >(); var appiumController = new AppiumController(restClientMock.Object, appiumRepositoryMock.Object, Logger); var result = appiumController.GetById(string.Empty); Assert.IsType <BadRequestObjectResult>(result); }
public void GetById_AppiumProcessNotInDatabase_NotFound() { var restClientMock = new Mock <IRestClient>(); var appiumRepositoryMock = new Mock <IRepository <AppiumProcess> >(); var appiumProcess = new AppiumProcess("123", "1111", "1112", 1, "1113", "1114"); appiumRepositoryMock.Setup(a => a.Find(It.IsAny <string>())).Returns((AppiumProcess)null); var appiumController = new AppiumController(restClientMock.Object, appiumRepositoryMock.Object, Logger); var result = appiumController.GetById("123"); Assert.IsType <NotFoundObjectResult>(result); }
public void GetById_ValidScenario_Ok() { var restClientMock = new Mock <IRestClient>(); var appiumRepositoryMock = new Mock <IRepository <AppiumProcess> >(); var appiumProcess = new AppiumProcess("123", "1111", "1112", 1, "1113", "1114"); appiumRepositoryMock.Setup(a => a.Find(It.IsAny <string>())).Returns(appiumProcess); var appiumController = new AppiumController(restClientMock.Object, appiumRepositoryMock.Object, Logger); var result = appiumController.GetById("123"); var viewResult = Assert.IsType <JsonResult>(result); Assert.Equal(appiumProcess, viewResult.Value); }