public void SquadDetailsShouldRenderInCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            const string Name = "Bat boy is not BATMAN!";
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", SquadId = 1 });

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test" });

            var vehiclesServiceMock = new Mock<IVehiclesService>();
            vehiclesServiceMock.Setup(x => x.GetAll())
                .Returns(new List<Vehicle>() { new Vehicle() { Model = "Test", Id = 1 } }.AsQueryable());

            var controller = new SquadAdministrationController(usersServiceMock.Object, squadsServiceMock.Object, vehiclesServiceMock.Object);
            controller.WithCallTo(x => x.SquadDetails(1))
                .ShouldRenderView("SquadDetails")
                .WithModel<SquadViewModel>(
                    viewModel =>
                    {
                        Assert.AreNotEqual(Name, viewModel.Name);
                    }).AndNoModelErrors();
        }
        public void PlatoonDetailsShouldRenderInCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            const string Name = "NANANNA";
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", Id="asd" });

            var platoonsServiceMock = new Mock<IPlatoonsService>();
            platoonsServiceMock.Setup(x => x.GetAll())
                .Returns(new List<Platoon>() { new Platoon() { Name = "Test", PlatoonCommanderId = "asd" } }.AsQueryable());

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test" });

            var controller = new PlatoonController(platoonsServiceMock.Object, squadsServiceMock.Object, usersServiceMock.Object);
            controller.WithCallTo(x => x.PlatoonDetails("asd"))
                .ShouldRenderPartialView("_PlatoonDetails")
                .WithModel<PlatoonDetailsViewModel>(
                    viewModel =>
                    {
                        Assert.AreNotEqual(Name, viewModel.Name);
                    }).AndNoModelErrors();
        }
        public void IndexShouldRenderInCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            List<Platoon> Platoons = new List<Platoon>() { new Platoon() { Name = "Test", Id = 2, PlatoonCommander = new User() { FirstName = "Asd", LastName = "Asd", Id = "asd" } } };
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", SquadId = 1 });

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test" });

            var platoonsServiceMock = new Mock<IPlatoonsService>();
            platoonsServiceMock.Setup(x => x.GetAll())
                .Returns(new List<Platoon>() { new Platoon() { Name = "Test", Id = 1, PlatoonCommander = new User() { FirstName = "Asd", LastName = "Asd", Id = "asd" } } }.AsQueryable());

            var controller = new PlatoonAdministrationController(platoonsServiceMock.Object, squadsServiceMock.Object, usersServiceMock.Object);
            controller.WithCallTo(x => x.Index())
                .ShouldRenderView("Index")
                .WithModel<PlatoonIndexModel>(
                    viewModel =>
                    {
                        Assert.AreNotEqual(Platoons.First().Id, viewModel.Platoons.First().Id);
                    }).AndNoModelErrors();
        }
        public void MissionShouldRenderCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            const string Info = null;
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", SquadId = 1 });

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test", ActiveMissionId = 1 });

            var missionsServiceMock = new Mock<IMissionsService>();
            missionsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Mission { SquadId = 0 });

            var controller = new MissionController(missionsServiceMock.Object, usersServiceMock.Object, squadsServiceMock.Object);
            controller.WithCallTo(x => x.Mission("asd"))
                .ShouldRenderPartialView("_MissionDetails")
                .WithModel<MissionDetailsViewModel>(
                    viewModel =>
                    {
                        Assert.AreEqual(Info, viewModel.Info);
                    }).AndNoModelErrors();
        }
        public void AddMissionShouldRenderInCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            const int Name = 0;
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", SquadId = 1 });

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test", ActiveMissionId = 1 });

            var missionsServiceMock = new Mock<IMissionsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test" });

            var controller = new MissionController(missionsServiceMock.Object, usersServiceMock.Object, squadsServiceMock.Object);
            controller.WithCallTo(x => x.AssignMission(1))
                .ShouldRenderPartialView("_AddMissionBox")
                .WithModel<AddMIssionInputModel>(
                    viewModel =>
                    {
                        Assert.AreNotEqual(Name, viewModel.SquadId);
                    }).AndNoModelErrors();
        }
        public void UserDetailsShouldRenderInCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            const decimal Wage = 1;
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>())) //UserDetails()
                .Returns(new User { FirstName = "Test", LastName = "Me", Wage = 0 });

            var controller = new UserController(usersServiceMock.Object);
            controller.WithCallTo(x => x.UserDetails("asd"))
                .ShouldRenderPartialView("_UserDetails")
                .WithModel<UserDetailsViewModel>(
                    viewModel =>
                    {
                        Assert.AreNotEqual(Wage, viewModel.Wage);
                    }).AndNoModelErrors();
        }
        public void MissionShouldRenderWithNullActiveMissionIdCorrectly()
        {
            var autoMapperConfig = new AutoMapperConfig();
            autoMapperConfig.Execute(typeof(UserController).Assembly);
            var usersServiceMock = new Mock<IUsersService>();
            usersServiceMock.Setup(x => x.GetById(It.IsAny<string>()))
                .Returns(new User { FirstName = "Test", SquadId = 1 });

            var squadsServiceMock = new Mock<ISquadsService>();
            squadsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Squad { Name = "Test" });

            var missionsServiceMock = new Mock<IMissionsService>();
            missionsServiceMock.Setup(x => x.GetById(It.IsAny<int>()))
                .Returns(new Mission { SquadId = 0 });

            var controller = new MissionController(missionsServiceMock.Object, usersServiceMock.Object, squadsServiceMock.Object);
            controller.WithCallTo(x => x.Mission("asd"))
                .ShouldRenderPartialView("_MissionDetails");
        }