public void TestPostBuilding() { Building a = new Building() { BuildingId = "1", Name = "Building1", Address = "Address", Admin = "1" }; var mockBuildingValidator = new Mock <IBuildingValidator>(); mockBuildingValidator.Setup(x => x.PostBuilding(a)).Verifiable(); mockBuildingValidator.Setup(x => x.secure(null)).Verifiable(); mockBuildingValidator.Setup(x => x.AtmSecure(null)).Verifiable(); var controller = new BuildingsController(mockBuildingValidator.Object); var controllerContext = new HttpControllerContext(); var request = new HttpRequestMessage(); request.Headers.Add("TODO_PAGOS_TOKEN", "1"); controllerContext.Request = request; controller.ControllerContext = controllerContext; IHttpActionResult actionResult = controller.PostBuilding(a); var contentResult = actionResult as OkNegotiatedContentResult <IEnumerable <Building> >; Assert.IsNotNull(actionResult); }
public void DetailsTestDepartment() { var controller = new BuildingsController(); var result = controller.Details(4) as ViewResult; var building = (Building)result.ViewData.Model; Assert.AreEqual("College of Engineering", building.Department.Name); }
public void DetailsTestAddress() { var controller = new BuildingsController(); var result = controller.Details(4) as ViewResult; var building = (Building)result.ViewData.Model; Assert.AreEqual("1891 SW Campus Wy.", building.Address); }
public void DetailsTestName() { var controller = new BuildingsController(); var result = controller.Details(4) as ViewResult; var building = (Building)result.ViewData.Model; Assert.AreEqual("Dearborn Hall", building.Name); }
public void IndexTest() { var controller = new BuildingsController(); var result = controller.Index() as ViewResult; var buildings = (ICollection <Building>)result.ViewData.Model; Assert.AreEqual("Bexell Hall", buildings.ToArray()[1].Name); }
public void TestDetailsView() { int?id; id = 2; var controller = new BuildingsController(); var result = controller.Details(id) as ViewResult; Assert.AreEqual("Details", result.ViewName); }
void Start() { moneyController = moneyControllerObject.GetComponent(typeof(MoneyController)) as MoneyController; buildingsController = GameObject.Find("BuildingsController").GetComponent <BuildingsController>(); mapController = GameObject.Find("MapController").GetComponent <MapController>(); defaultRotation = Quaternion.Euler(new Vector3(-90, 0, 0)); roadsOnlyNavMesh = GameObject.Find("RoadsOnlyNavMesh").GetComponent <NavMeshSurface>(); buildingDisplayer = GameObject.Find("ConstructingBuildingsDisplayer").GetComponent <ConstructingBuildingDisplayer>(); uiController = GameObject.Find("GameUI").GetComponent <UIController>(); }
public void Index() { // Arrange BuildingsController controller = new BuildingsController(); // Act ViewResult result = controller.Index("Name", false) as ViewResult; // Assert Assert.IsNotNull(result); }
protected void Application_AuthorizeRequest() { if (User.Identity.IsAuthenticated) { string userGuidId = User.Identity.GetUserId(); BuildingsController bc = new BuildingsController(); bc.CheckForFinishedBuildings(userGuidId); bc.CheckForFinishedUnits(userGuidId); bc.UpdateResources(userGuidId); } }
public void SetUp() { _buildingRepository = Substitute.For <IBuildingRepository>(); _companyRepository = Substitute.For <ICompanyRepository>(); _userSession = Substitute.For <IUserSession>(); _userRepository = Substitute.For <IUserRepository>(); _mailService = Substitute.For <IMailService>(); _buildingsController = new BuildingsController(_buildingRepository, _companyRepository, _userSession, _userRepository, _mailService); }
public void DeleteTest() { var controller = new BuildingsController(); var result = controller.Index() as ViewResult; var buildings = (ICollection <Building>)result.ViewData.Model; var Id = buildings.Last().BuildingId; controller.DeleteConfirmed(Id); var result2 = controller.Index() as ViewResult; var buildings2 = (ICollection <Building>)result.ViewData.Model; Assert.AreNotEqual(Id, buildings2.Last().BuildingId); }
public void EditTest() { var controller = new BuildingsController(); var result = controller.Index() as ViewResult; var buildings = (ICollection <Building>)result.ViewData.Model; var editBuilding = buildings.Last(); editBuilding.Name = "NewBuildingName"; editBuilding.Address = "NewBuildingAddress"; controller.Edit(editBuilding); var result2 = controller.Index() as ViewResult; var buildings2 = (ICollection <Building>)result2.ViewData.Model; Assert.AreEqual("NewBuildingName", buildings2.Last().Name); }
public void CreateTest() { var newBuilding = new Building(); newBuilding.Name = "TestBuildingName"; newBuilding.Address = "TestBuildingAddress"; newBuilding.DepartmentId = 1; var controller = new BuildingsController(); controller.Create(newBuilding); var result = controller.Index() as ViewResult; var buildings = (ICollection <Building>)result.ViewData.Model; Assert.AreEqual("TestBuildingName", buildings.Last().Name); }
//[ExpectedException(typeof(Exception))] public void TestGetBuildings() { var allBuildings = new[] { new Building() { BuildingId = "1", Name = "Building1", Address = "Address", Admin = "1" }, new Building() { BuildingId = "2", Name = "Building2", Address = "Address", Admin = "2" }, }; var mockBuildingValidator = new Mock <IBuildingValidator>(); mockBuildingValidator.Setup(x => x.GetBuildings()).Returns(allBuildings); var controller = new BuildingsController(mockBuildingValidator.Object); // Arrange var controllerContext = new HttpControllerContext(); var request = new HttpRequestMessage(); request.Headers.Add("TODO_PAGOS_TOKEN", "1"); // Don't forget these lines, if you do then the request will be null. controllerContext.Request = request; controller.ControllerContext = controllerContext; IHttpActionResult actionResult = controller.GetBuildings(); //throw new Exception(actionResult.GetType().ToString()); var contentResult = actionResult as OkNegotiatedContentResult <IEnumerable <Building> >; Assert.IsNotNull(contentResult); }
public void SetUp() { controller = new BuildingsController(); }
//private List<Risk> allRisks = new List<Risk>(); void Start() { tileController = this.GetComponent(typeof(TileController)) as TileController; buildingsController = GameObject.Find("BuildingsController").GetComponent <BuildingsController>(); hotSpot = tileController.hotSpot; }