示例#1
0
 public static void Init()
 {
     GroupController.LoadGroups();
     VehicleController.LoadVehicles();
     PropertyController.LoadProperties();
     JobController.LoadJobs();
 }
示例#2
0
        public void Verify_EditAction_MustHaveAuthorizeRolesAttribute()
        {
            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var hasAttribute = TestHelper.MethodHasAuthorizeAttribute(() => controller.Edit(2));

            Assert.IsTrue(hasAttribute);
        }
        public void Search_InvalidModel_ReturnsModel()
        {
            //Arrange
            var model = _fixture.Create <PropertySearchViewModel>();

            var controller = new PropertyController(_propertyRepository.Object);

            //Set model to be invalid
            controller.ModelState.AddModelError("test", "test");

            //Act
            var result = controller.Search(model);

            //Assert
            var viewResult = result as ViewResult;

            Assert.IsNotNull(viewResult);
            var viewModel = viewResult.Model as PropertySearchViewModel;

            Assert.IsNotNull(viewModel);
            Assert.AreSame(model, viewModel);

            //Never call repository
            _propertyRepository.Verify(x => x.GetProperties(It.IsAny <Requirements>()), Times.Never);
        }
示例#4
0
 public void SetUp()
 {
     _mockGetPropertyUseCase           = new Mock <IGetPropertyUseCase>();
     _mockLogger                       = new Mock <ILogger <PropertyController> >();
     _mockGetMultiplePropertiesUseCase = new Mock <IGetMultiplePropertiesUseCase>();
     _classUnderTest                   = new PropertyController(_mockGetPropertyUseCase.Object, _mockLogger.Object, _mockGetMultiplePropertiesUseCase.Object, null);
 }
示例#5
0
        public void TestDetailsView()
        {
            var controller = new PropertyController();
            var result = controller.Details("12345");
            Assert.AreEqual(Property, result.

        }
示例#6
0
 public void CreateProperty(Client player, string ownerType, PropertyType type, string idOrName, int cost)
 {
     if (!AdminController.AdminRankCheck(player, "createproperty"))
     {
         return;
     }
     PropertyController.CreateProperty(player, ownerType, type, idOrName, cost);
 }
示例#7
0
 public void CreateHome(Client player, int cost)
 {
     if (!AdminController.AdminRankCheck(player, "createhome"))
     {
         return;
     }
     PropertyController.CreateHome(player, cost);
 }
        public void Add_Not_Null()
        {
            PropertyController controller = new PropertyController(propertyService, tenantService);

            ViewResult result = controller.Add() as ViewResult;

            Assert.That(result, Is.Not.Null);
        }
        public void Index_Not_Null()
        {
            int propertyId = 1;
            PropertyController controller = new PropertyController(propertyService, tenantService);

            ViewResult result = controller.Index(propertyId) as ViewResult;

            Assert.That(result, Is.Not.Null);
        }
示例#10
0
        public void SetUp()
        {
            MockData.SetUp();
            _context = Substitute.For <IOrangeBricksContext>();
            _context.Properties.Returns(MockData.Properties);
            _context.Offers.Returns(MockData.Offers);

            _controller = MockData.CreateControllerContext(new PropertyController(_context));
        }
示例#11
0
        public void Verify_CreateAction_Only_Role_Sales_Returns_Create_View()
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)StaffType.IsSales);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var viewResult = controller.Create() as ViewResult;

            Assert.IsNotNull(viewResult);
            Assert.AreEqual("Create", viewResult.ViewName);
        }
示例#12
0
        public static PropertyController GetProperty(ColShape shape)
        {
            PropertyController rProperty = Properties.Find(x => x.ExteriorColShape == shape);

            if (rProperty == null)
            {
                rProperty = Properties.Find(x => x.InteteriorColShape == shape);
            }
            return(rProperty);
        }
示例#13
0
        //public void Login(string email, string pass)
        //{
        //    using (var controller = new AccountController())
        //    {
        //        _context = controller.Login(email, pass);
        //    }
        //}



        public void ViewDetail(string propertyName)
        {
            var db = new DemoPPCRentalEntities();

            int id = db.PROPERTY.FirstOrDefault(r => r.PropertyName == propertyName).ID;

            using (var controller = new PropertyController())
            {
                _context = controller.Details(id);
            }
        }
        public void Index()
        {
            // 1. Arrange
            PropertyController propertyController = new PropertyController();

            // 2. Act
            ViewResult result = propertyController.Index() as ViewResult;

            // 3. Assert
            Assert.IsNotNull(result);
        }
示例#15
0
        public void ReturnsCorrectResponseWhenNotFound()
        {
            var expectedResult = new GetPropertyUseCase.GetPropertyByRefResponse(null);

            _mockGetPropertyUseCase.Setup(m => m.Execute(It.IsAny <string>())).Returns(expectedResult);
            _classUnderTest = new PropertyController(_mockGetPropertyUseCase.Object, _mockLogger.Object, null, null);

            var response = _classUnderTest.GetByReference("foo");

            Assert.NotNull(response);
            Assert.IsInstanceOf(typeof(NotFoundResult), response);
        }
示例#16
0
        public void Setup()
        {
            var config = PropertyHelper.ConfigureMapper();

            _factory = new PropertyFactory(config.CreateMapper());
            var _gateway = new PropertyGateway(_uhContext, _factory);

            _useCase = new GetPropertyChildrenUseCase(_gateway);
            var mockLogger = new Mock <ILogger <PropertyController> >();

            _classUnderTest = new PropertyController(null, mockLogger.Object, null, _useCase);
        }
示例#17
0
        public void SetUp()
        {
            var config = PropertyHelper.ConfigureMapper();

            _factory = new PropertyFactory(config.CreateMapper());

            _mockLogger = new Mock <ILogger <PropertyController> >();

            _getMultiplePropertiesGateway = new PropertyGateway(_uhContext, _factory);
            _getMultiplePropertiesUseCase = new GetMultiplePropertiesUseCase(_getMultiplePropertiesGateway);
            _classUnderTest = new PropertyController(null, _mockLogger.Object, _getMultiplePropertiesUseCase, null);
        }
示例#18
0
        static void testAPI()
        {
            FileController     fileC     = new FileController();
            PropertyController propertyC = new PropertyController();

            //File testFile = fileC.CreateNewFile(@"C:\Users\Dorian\Pictures\1605383.jpg", "Illidan Picture");
            //testFile = fileC.AddFile(testFile);
            //fileC.DeleteFile(testFile.Id);

            Property newProperty = propertyC.CreateProperty("Characters", "The characters that are in the photo", "string");

            newProperty = propertyC.AddProperty(newProperty);
        }
        public void Setup()
        {
            InitializeDbContextServices();

            serviceProvider    = services.BuildServiceProvider();
            context            = serviceProvider.GetRequiredService <AppDBContext>();
            propertyService    = serviceProvider.GetRequiredService <IPropertyService>();
            propertyRepository = serviceProvider.GetRequiredService <IPropertyRepository>();
            searchResultsModel = serviceProvider.GetRequiredService <SearchResultsModel>();
            propertyModel      = serviceProvider.GetRequiredService <PropertyModel>();

            _controller = serviceProvider.GetRequiredService <PropertyController>();
        }
示例#20
0
        public void Verify_IndexAction_with_Role_Admin_Returns_PropertyListReadOnly_View(StaffType staffType)
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)staffType);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var resultTask = controller.Index();

            resultTask.Wait();
            var viewResult = resultTask.Result as ViewResult;

            Assert.IsNotNull(viewResult);
            Assert.AreEqual("PropertyListReadOnly", viewResult.ViewName);
        }
示例#21
0
        public void Verify_DeleteAction_Only_Role_SalesDepartmentAdmin_Can_Execute()
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)StaffType.IsSalesDepartmentAdmin);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var resultTask = controller.Delete(3);

            resultTask.Wait();
            var viewResult = resultTask.Result as ViewResult;

            Assert.IsNotNull(viewResult);
            Assert.AreEqual("EditSalesAdmin", viewResult.ViewName);
        }
示例#22
0
        public void Verify_EditAction_with_Role_Sales_Returns_Edit_View(StaffType staffType)
        {
            mockUserAccountResolver.Setup(x => x.GetCurrentUserRole()).Returns((int)staffType);

            PropertyController controller = new PropertyController(mockAppUriResolver.Object, mockUserAccountResolver.Object);
            var resultTask = controller.Edit(2);

            resultTask.Wait();
            var viewResult = resultTask.Result as ViewResult;

            Assert.IsNotNull(viewResult);
            Assert.AreEqual("Edit", viewResult.ViewName);
        }
示例#23
0
        public async void Test1()
        {
            //Arrange
            var dbContext = MockDb.CreateMockDb();
            PropertyController propertyController = new PropertyController(dbContext);
            //Act
            var res = await propertyController.Index();

            //Assert
            var result = Assert.IsType <ViewResult>(res);
            var model  = Assert.IsAssignableFrom <List <PropertyModel> >(result.ViewData.Model);

            Assert.Equal(1, model.Count());
        }
        public async Task Given_A_Request_To_Update_An_Individual_Property_When_THePropertyDoesNotExist_Then_ReturnNotFound()
        {
            //Arrange
            string propertyReference = "P009";

            mediatorMock.Setup(x => x.Send(It.IsAny <Update.Command>(), default(CancellationToken))).Returns(Task.FromResult <Update.Result>(null));

            //Act
            var sut          = new PropertyController(mediatorMock.Object);
            var actionResult = await sut.PartialPropertyUpdate(propertyReference, new JsonPatchDocument <PropertyPatchModel>()) as NotFoundResult;

            //Assert
            Assert.NotNull(actionResult);
            Assert.Equal(actionResult.StatusCode, (Int32)System.Net.HttpStatusCode.NotFound);
        }
示例#25
0
        public void createproperty(Client player, string OwnerType, PropertyType type, string IDOrName)
        {
            AccountController account = player.getData("ACCOUNT");

            if (account == null)
            {
                return;
            }
            if (!AdminController.AdminRankCheck("createproperty", account))
            {
                return;
            }

            PropertyController.CreateProperty(player, OwnerType, type, IDOrName);
        }
        public void Create()
        {
            // 1. Arrange
            // Create the Ticket, Property, and Tenant objects
            Ticket   ticket_1 = new Ticket();
            Property property = new Property();
            Tenant   tenant_1 = new Tenant();

            // Set the corresponding properties
            ticket_1.ID       = "0";
            ticket_1.Issuer   = "John Smith";
            ticket_1.Location = "123 Lane Way";
            ticket_1.OpenTime = "";

            property.ID      = "0";
            property.Address = "123 Lane Way";

            tenant_1.ID       = "0";
            tenant_1.Name     = "John Smith";
            tenant_1.Phone    = "123-456-7890";
            tenant_1.Property = property;

            // Declare & initialize a List of Tickets
            List <Ticket> tickets = new List <Ticket>()
            {
                ticket_1
            };

            // Declare & Initialize a List of Tenants
            List <Tenant> tenants = new List <Tenant>()
            {
                tenant_1
            };

            // Bind the Lists
            property.Tenants = tenants;
            property.Tickets = tickets;


            PropertyController propertyController = new PropertyController();

            // 2. Act
            ViewResult result = propertyController.Create() as ViewResult;

            // 3. Assert
            Assert.IsNotNull(property, result.ViewBag.Message);
        }
示例#27
0
        private void OnClientEventTrigger(Client player, string eventName, object[] args)
        {
            if (eventName == "onKeyDown")
            {
                if ((int)args[0] == 2)
                {
                    PropertyController PropertController = player.getData("AT_PROPERTY");
                    if ((PropertController = player.getData("AT_PROPERTY")) != null)
                    {
                        PropertController.PropertyDoor(player);
                    }
                }
                else if ((int)args[0] == 3)
                {
                    if (player.isInVehicle)
                    {
                        player.vehicle.specialLight = true;
                    }
                }
                else if ((int)args[0] == 4)
                {
                    if (player.isInVehicle)
                    {
                        player.vehicle.specialLight = true;
                    }
                }
                else if ((int)args[0] == 5)
                {
                    if (player.isInVehicle)
                    {
                        Vehicles.VehicleController.TriggerDoor(player.vehicle, 4);
                    }
                }
                else if ((int)args[0] == 6)
                {
                    if (player.isInVehicle)
                    {
                        Vehicles.VehicleController.TriggerDoor(player.vehicle, 5);
                    }
                }

                else if ((int)args[0] == 8)
                {
                    CharacterController.StopAnimation(player);
                }
            }
        }
示例#28
0
        private VRAMViewer(MainForm xiMainForm) : base(xiMainForm)
        {
            //add view mode menus:
            mOptionsMenu = new ToolStripMenuItem("VRAM");
            //
            // create menu options
            PropertyController.NamedValueHolder[] lPropValues = new PropertyController.NamedValueHolder[33];
            lPropValues[0] = new PropertyController.NamedValueHolder("Show entire VRAM", -1);
            for (int i = 0; i < 32; i++)
            {
                lPropValues[i + 1] = new PropertyController.NamedValueHolder(string.Format("Page {0}", i), i);
            }
            PropertyController lPageCtrl = new PropertyController(this, "SelectedPage", lPropValues);

            mOptionsMenu.DropDownItems.AddRange(lPageCtrl.CreateMenuItems());

            mMainForm.mMenuStrip.Items.Add(mOptionsMenu);
        }
示例#29
0
        public void ReturnsCorrectResponseWithOkStatus()
        {
            var expectedResult = new GetPropertyUseCase.GetPropertyByRefResponse(new Property
            {
                PropRef   = faker.Random.String(12),
                Telephone = faker.Phone.PhoneNumber()
            });

            _mockGetPropertyUseCase.Setup(m => m.Execute(It.IsAny <string>())).Returns(expectedResult);
            _classUnderTest = new PropertyController(_mockGetPropertyUseCase.Object, _mockLogger.Object, null, null);

            var response = _classUnderTest.GetByReference("foo");

            Assert.NotNull(response);
            Assert.AreEqual(200, ((ObjectResult)response).StatusCode);
            Assert.AreEqual(JsonConvert.SerializeObject(expectedResult.Property),
                            JsonConvert.SerializeObject(((ObjectResult)response).Value));
        }
        public async Task Given_A_Request_To_Create_An_Individual_Property_When_ThePropertyIsValid_Then_ReturnCreated()
        {
            //Arrange
            string propertyReference   = "P009";
            string propertyDescription = "This ia a test description";

            mediatorMock.Setup(x => x.Send(It.IsAny <CreateWithReferenceAndDescription.Command>(), default(CancellationToken))).Returns(Task.FromResult <Int32>(0));

            //Act
            var sut          = new PropertyController(mediatorMock.Object);
            var actionResult = await sut.Create(new CreateWithReferenceAndDescription.Command()
            {
                PropertyReference = propertyReference, PropertyDescription = propertyDescription
            }) as CreatedAtActionResult;

            //Assert
            Assert.NotNull(actionResult);
            Assert.Equal(actionResult.StatusCode, (Int32)System.Net.HttpStatusCode.Created);
        }