Esempio n. 1
0
        public ActionResult ImportTiles(string Id)
        {
            // pass client into constructor
            var model = new IndexedLocationModel(client, Id);

            model.RequestIndexedLocation(client);

            return(View("ImportTiles", model));
        }
        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 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);
        }
Esempio n. 4
0
        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));
            }
        }