Beispiel #1
0
        public AppartmentControllerTest()
        {
            //_fixture = new Fixture();
            _mockLogger = new Mock <ILogger <AppartmentController> >();
            _mockRepo   = new Mock <ICommunityRepository>();
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });

            _mapper = mappingConfig.CreateMapper();


            if (new AppConfigration().IsRealMongoDbUsed())
            {
                var dbConfig  = new AppConfigration().GetMongoDBConfig();
                var dbContext = new CommunityContext(dbConfig);
                _repo = new CommunityRepository(dbContext);
                var dbSeeder = new CommunitySeeder(_repo);
                dbSeeder.Seed();

                _controller = new AppartmentController(_mockLogger.Object, _repo, _mapper);
            }
            else
            {
                _controller = new AppartmentController(_mockLogger.Object, _mockRepo.Object, _mapper);
            }
        }
        public void Contact()
        {
            // Arrange
            AppartmentController controller = new AppartmentController();

            // Act
            ViewResult result = controller.Contact() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
        public void About()
        {
            // Arrange
            AppartmentController controller = new AppartmentController();

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
        }