public void UpdateIndexedLocationReturnsErrorIfIndexedLocationNull() { var model = new IndexedLocationModel(MockMakerClient.Object); var response = model.UpdateIndexedLocation(MockMakerClient.Object, null); Assert.IsTrue(!String.IsNullOrEmpty(response.Error)); }
public void ProjectIdIsSetCorrectlyByConstructor() { string projectId = "projectId"; var model = new IndexedLocationModel(MockMakerClient.Object, projectId); Assert.AreEqual(projectId, model.ProjectId); }
public ActionResult ImportTiles(string Id) { // pass client into constructor var model = new IndexedLocationModel(client, Id); model.RequestIndexedLocation(client); return(View("ImportTiles", model)); }
public void IsPathValidFalseIfIndexedLocationInvalid() { var model = new IndexedLocationModel(MockMakerClient.Object); foreach (var location in invalidLocations) { model.IndexedLocation = location; Assert.IsFalse(model.IsIndexedLocationValid); } }
public void IndexedLocationSetToReturnedValueIfValid() { var indexedLocation = "Location"; MockMakerClient.Setup(x => x.ReadIndexedLocation()).Returns(new IndexedLocationResponse { IndexedLocation = indexedLocation }); var model = new IndexedLocationModel(MockMakerClient.Object); model.RequestIndexedLocation(MockMakerClient.Object); Assert.AreEqual(indexedLocation, model.IndexedLocation); }
public ActionResult UpdateIndexedLocation(string indexedLocation, string id) { // pass client into constructor var model = new IndexedLocationModel(client, id); var response = model.UpdateIndexedLocation(client, indexedLocation); if (String.IsNullOrEmpty(response.Error)) { Response.StatusCode = (int)HttpStatusCode.OK; return(Json("The indexed location request was valid")); } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(Json(response.Error)); }
public void PartialModelPropertySetCorrectlyByConstructor() { string projectId = "projectId"; MockMakerClient.Setup(x => x.ReadProject(It.IsAny <string>())).Returns(new ProjectResponse { Project = new ProjectStructure() { Id = projectId, Progress = ProjectStructure.Types.State.Smalladded } }); var model = new IndexedLocationModel(MockMakerClient.Object, projectId); Assert.AreEqual(projectId, model.PartialModel.Item1); Assert.AreEqual(ProjectStructure.Types.State.Smalladded, model.PartialModel.Item2); }
public void IndexedLocationNotSetIfErrorReturned() { var newIndexedLocation = "NewLocation"; var error = "Error"; MockMakerClient.Setup(x => x.ReadIndexedLocation()).Returns(new IndexedLocationResponse { IndexedLocation = newIndexedLocation, Error = error }); var originalIndexedLocation = "OriginalLocation"; var model = new IndexedLocationModel(MockMakerClient.Object) { IndexedLocation = originalIndexedLocation }; model.RequestIndexedLocation(MockMakerClient.Object); Assert.AreEqual(originalIndexedLocation, model.IndexedLocation); Assert.AreEqual(error, model.Error); }
public IActionResult SelectProject(string Id) { // pass client into constructor var model = new IndexedLocationModel(client, Id); model.RequestIndexedLocation(client); var progress = client.ReadProject(Id).Project.Progress; if (progress == ProjectStructure.Types.State.Smalladded || progress == ProjectStructure.Types.State.Completed) { return(new TileController().Generate(Id)); } else if (progress == ProjectStructure.Types.State.Largeadded) { return(new MasterController().ImportTiles(Id)); } else { return(ImportMaster(Id)); } }