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);
        }
        public void Index()
        {
            // 1. Arrange
            PropertyController propertyController = new PropertyController();

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

            // 3. Assert
            Assert.IsNotNull(result);
        }
示例#3
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);
        }
示例#4
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());
        }
示例#5
0
        public void Index()
        {
            //Arrange - is done by the class Setup
            // Act
            var result = _controller.Index(new PropertiesQuery());

            // Assert
            Assert.IsAssignableFrom(typeof(ViewResult), result);
            ViewResult viewResult = result as ViewResult;

            Assert.IsAssignableFrom(typeof(PropertiesViewModel), viewResult.Model);
            PropertiesViewModel model = viewResult.Model as PropertiesViewModel;

            Assert.True(model.Properties.Count() == 2); // 2 properties for sale
            Assert.False(model.Properties.Any(p => !p.IsListedForSale));
        }
示例#6
0
        public void Attend_UserAttendingAGigForWhichHeHasAnAttendance_ShouldReturnBadRequest()
        {
            var properties = new List <PropertyViewModel>()
            {
                new PropertyViewModel()
                {
                    Id = 1, Name = "example1", Description = "example1"
                },
                new PropertyViewModel()
                {
                    Id = 2, Name = "example2", Description = "example2"
                },
                new PropertyViewModel()
                {
                    Id = 3, Name = "example3", Description = "example3"
                },
                new PropertyViewModel()
                {
                    Id = 4, Name = "example4", Description = "example4"
                },
                new PropertyViewModel()
                {
                    Id = 5, Name = "example5", Description = "example5"
                },
                new PropertyViewModel()
                {
                    Id = 6, Name = "example6", Description = "example6"
                },
            };

            _mockService.Setup(r => r.GetPropertyList()).Returns(properties);

            var result = _controller.Index("name_desc", "", "", 5);

            result.Should().Be(properties);
        }