コード例 #1
0
        public void GetPropertiesTest()
        {
            var actionResult = PropertyController.GetProperties(new PropertiesParameters()).Result;

            Assert.AreEqual(((ObjectResult)actionResult).StatusCode, (int)System.Net.HttpStatusCode.OK);
            Assert.AreEqual(((ObjectResult)actionResult).Value.ToString().ToEntityListSimple <Property>().FirstOrDefault().IdProperty, FakeProperty.IdProperty);
        }
コード例 #2
0
        public void GetPropertiesReturnsProperties()
        {
            //Arrange: Instantiate PropertiesController so its methods can be called
            using (var propertyController = new PropertiesController())
            {
                //Act: Call the GetProperties method
                IEnumerable <PropertyModel> properties = propertyController.GetProperties();

                //Assert: Verify that an array was returned with at least one element
                Assert.IsTrue(properties.Count() > 0);
            }
        }
コード例 #3
0
        [TestMethod] // [0] | Get Properties
        public void GetPropertiesReturnProperties()
        {
            //Arrange
            //Properties Go Here
            var PropertiesController = new PropertiesController();

            //Act
            //Call the mthod in question that needs to be tested
            IEnumerable <PropertyModel> property = PropertiesController.GetProperties();

            //Assert
            Assert.IsTrue(property.Count() > 0);
        }
コード例 #4
0
        public void GetRepositoriesReturnsEmptyListIfDbEmpty()
        {
            // Arrange
            var service = new Mock <IPropertyRepository>();

            service.Setup(m => m.GetProperties()).Returns(new List <Property>());
            var sut = new PropertiesController(service.Object);

            // Act
            var result = sut.GetProperties() as OkObjectResult;


            // Assert
            Assert.That(result.StatusCode, Is.EqualTo(200));
            Assert.That(result.Value, Is.TypeOf <List <PropertyDto> >());
            Assert.That(result.Value, Is.Empty);
        }