public void TestInitialize()
        {
            Category = new Category()
            {
                Id   = 1,
                Name = "Category1"
            };

            var fileMock = new Mock <IFormFile>();

            TouristSpotModel = new TouristSpotModel()
            {
                Name        = "name",
                Description = "description",
                Image       = fileMock.Object,
                Categories  = new List <int> {
                    Category.Id
                },
                RegionId = 1
            };

            TouristSpotSearchModel = new TouristSpotSearchModel()
            {
                Region     = 1,
                Categories = new[] { Category.Id }
            };

            TouristSpotLogicMock = new Mock <ITouristSpotLogic>(MockBehavior.Strict);
        }
Beispiel #2
0
        public IActionResult Post([FromForm] TouristSpotModel touristSpotModel)
        {
            IActionResult result;

            if (touristSpotModel.HasErrors())
            {
                result = BadRequest(new ErrorModel(touristSpotModel.Errors()));
            }
            else
            {
                var touristSpot = TouristSpotLogic.Create(touristSpotModel.ToEntity());
                result = Created("GetTouristSpot", new TouristSpotBasicInfoModel(touristSpot));
            }

            return(result);
        }
        public void TestInitialize()
        {
            var fileMock = new Mock <IFormFile>();

            TouristSpotModel = new TouristSpotModel()
            {
                Name        = "name",
                Description = "description",
                Image       = fileMock.Object,
                Categories  = new List <int>()
                {
                    1
                },
                RegionId = 1
            };
        }