public void SetUp()
        {
            _disaster = new Mock<IDisaster>();

            _cluster = new Mock<ICluster>();

            _disasterClusterService = new Mock<IDisasterClusterService>();

            _controllerUnderTest = new DisasterController(_disaster.Object, _cluster.Object, _disasterClusterService.Object);
        }
        public void Assign_ValidDataAdd_ReturnsListView()
        {
            // Arrange
            var disaster = new Mock<IDisaster>();

            var controller = new DisasterController(disaster.Object);

            // Act
            var viewModel = new Disaster { Id = -1, Name ="test", IsActive = false};
            var response = controller.Create(viewModel);

            // Assert
            var result = response as RedirectResult;
            Assert.IsTrue(result.Url.Equals("/Disaster/List"));
        }
        public void Assign_duplicateName_ReturnsCreateView()
        {
            // Arrange
            var disaster = new Mock<IDisaster>();

            var controller = new DisasterController(disaster.Object);

            disaster.Setup(x => x.Create(
                It.IsAny<Disaster>())).Throws(new DisasterAlreadyExistsException());

            var viewModel = new Disaster { Id = -1, Name = "test", IsActive = true };
            var response = controller.Create(viewModel);

            var view = response as ViewResult;
            Assert.AreEqual("Create", view.ViewName);
            Assert.IsTrue(view.ViewData.ModelState.Count >= 1);
        }
        public void SetUp()
        {
            _disaster = new Mock<IDisaster>();

            _controllerUnderTest = new DisasterController(_disaster.Object);
        }