public void ReturnProfileFormWithEmpty_WhenModelStatusIsInvalid()
        {
            // Arrange
            var mockedIndividualService   = new Mock <IIndividualService>();
            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper       = new Mock <IMapper>();
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ModelState.AddModelError("test", "test");

            var model = new IndividualViewModel();

            var mockedUpload = new Mock <HttpPostedFileBase>();

            // Act & Assert
            controller
            .WithCallTo(x => x.Submit(model, mockedUpload.Object))
            .ShouldRenderView("ProfileForm");
            //.ShouldRedirectTo<AccountController>(typeof(AccountController).GetMethod("ProfileForm"))
            //.WithRouteValue("model");
        }
示例#2
0
        public void ReturnPartialViewwithCorrectModel_WhenIsAjax()
        {
            // Arrange
            var username  = "******";
            var id        = Guid.NewGuid();
            var viewModel = new IndividualViewModel();

            viewModel.Id = id;
            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(new SofiaDayAndNight.Data.Models.Individual());
            mockedIndividualService.Setup(x => x.RemoveFriendship(It.IsAny <string>(), It.IsAny <Guid>())).Verifiable();
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();
            var mockedMapper       = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <IndividualViewModel>(It.IsAny <SofiaDayAndNight.Data.Models.Individual>())).Returns(viewModel);

            var request = new Mock <HttpRequestBase>();

            request.SetupGet(x => x.Headers).Returns(
                new WebHeaderCollection()
            {
                { "X-Requested-With", "XMLHttpRequest" }
            }
                );
            var httpContext = new Mock <HttpContextBase>();

            httpContext.SetupGet(x => x.Request).Returns(request.Object);
            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            httpContext.SetupGet(x => x.User).Returns(principal.Object);
            controllerContext.SetupGet(x => x.HttpContext).Returns(httpContext.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ControllerContext = controllerContext.Object;

            //Act & Assert
            controller
            .WithCallTo(x => x.CancelFriendship(Guid.NewGuid()))
            .ShouldRenderPartialView("_IndividualInfoPartial")
            .WithModel <IndividualViewModel>(model =>
            {
                Assert.AreEqual(viewModel.Id, model.Id);
            });
        }
        public void CallMapMethod_WhenCollectionFound()
        {
            // Arrange
            var username = "******";
            var model    = new EventViewModel();

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetCurrentEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });
            mockedIndividualService.Setup(x => x.GetPassedEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });
            mockedIndividualService.Setup(x => x.GetUpcomingEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <EventViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Event>()))
            .Returns(model);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            //var principal = new Mock<IPrincipal>();
            //var controllerContext = new Mock<ControllerContext>();
            //principal.SetupGet(x => x.Identity.Name).Returns(username);
            //controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            //controller.ControllerContext = controllerContext.Object;

            // Act
            controller.EventsList(username);

            // Assert
            mockedMapper.Verify(x => x.Map <EventViewModel>(
                                    It.IsAny <SofiaDayAndNight.Data.Models.Event>()), Times.Exactly(3));
        }
示例#4
0
        public void ReturnViewWithCorrectModel_WhenUsernameMatch()
        {
            //Arrange
            var username = "******";
            var model    = new IndividualViewModel();

            model.UserName = username;

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetByUsername(username))
            .Returns(new SofiaDayAndNight.Data.Models.Individual());
            mockedIndividualService.Setup(x => x.GetStatus(It.IsAny <string>(), model.Id))
            .Returns(IndividualStatus.None);

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <IndividualViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Individual>()))
            .Returns(model);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ControllerContext = controllerContext.Object;

            //Act & Assert
            controller
            .WithCallTo(x => x.ProfileDetails(username))
            .ShouldRenderDefaultView()
            .WithModel <IndividualViewModel>(m =>
            {
                Assert.AreEqual(model.UserName, m.UserName);
                Assert.AreEqual(model.Id, m.Id);
            });
        }
示例#5
0
        public void CallMapMethod_WhenIsAjax()
        {
            // Arrange
            var username = "******";
            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(new SofiaDayAndNight.Data.Models.Individual());
            mockedIndividualService.Setup(x => x.RemoveFriendship(It.IsAny <string>(), It.IsAny <Guid>())).Verifiable();
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();
            var mockedMapper       = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <IndividualViewModel>(It.IsAny <SofiaDayAndNight.Data.Models.Individual>())).Returns(new IndividualViewModel());

            var request = new Mock <HttpRequestBase>();

            request.SetupGet(x => x.Headers).Returns(
                new WebHeaderCollection()
            {
                { "X-Requested-With", "XMLHttpRequest" }
            }
                );
            var httpContext = new Mock <HttpContextBase>();

            httpContext.SetupGet(x => x.Request).Returns(request.Object);
            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            httpContext.SetupGet(x => x.User).Returns(principal.Object);
            controllerContext.SetupGet(x => x.HttpContext).Returns(httpContext.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ControllerContext = controllerContext.Object;

            // Act
            controller.CancelFriendship(Guid.NewGuid());

            // Assert
            mockedMapper.Verify(x =>
                                x.Map <IndividualViewModel>(It.IsAny <SofiaDayAndNight.Data.Models.Individual>()), Times.Once);
        }
        public void ReturnsAnInstance_WhenParameterIsNotNull()
        {
            // Arrange
            //var mockedEventService = new Mock<IEventService>();
            var mockedIndividualService = new Mock <IIndividualService>();
            var mockedMapper            = new Mock <IMapper>();
            var mockedPhotoHelper       = new Mock <IPhotoHelper>();
            var mockedUserProvider      = new Mock <IUserProvider>();

            // Act
            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            // Assert
            Assert.IsNotNull(controller);
        }
        public void CallUploadImage_WhenModelUploadIsValid()
        {
            // Arrange
            var username  = "******";
            var user      = new User();
            var viewModel = new IndividualViewModel();
            var mockedIndividualService = new Mock <IIndividualService>();
            var mockedPhotoHelper       = new Mock <IPhotoHelper>();
            var mockedUserProvider      = new Mock <IUserProvider>();

            mockedUserProvider.Setup(x => x.FindByName(It.IsAny <string>())).Returns(user);
            mockedUserProvider.Setup(x => x.Update(user)).Verifiable();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <SofiaDayAndNight.Data.Models.Individual>(It.IsAny <IndividualViewModel>()))
            .Returns(new SofiaDayAndNight.Data.Models.Individual());

            var mockedUpload = new Mock <HttpPostedFileBase>();

            mockedUpload.SetupGet(x => x.ContentLength).Returns(1);
            mockedPhotoHelper.Setup(x => x.UploadImage(mockedUpload.Object)).Verifiable();

            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ModelState.Clear();
            controller.ControllerContext = controllerContext.Object;

            // Act
            controller.Submit(viewModel, mockedUpload.Object);

            // Assert
            mockedPhotoHelper.Verify(x => x.UploadImage(mockedUpload.Object), Times.Once);
        }
示例#8
0
        public void RedirectToCorrectAction_WhenIsNotAjax()
        {
            // Arrange
            var username = "******";
            var mockedIndividualService = new Mock <IIndividualService>();

            //mockedIndividualService.Setup(x => x.GetById(It.IsAny<Guid>())).Returns(new SofiaDayAndNight.Data.Models.Individual());
            mockedIndividualService.Setup(x => x.RemoveFriendship(It.IsAny <string>(), It.IsAny <Guid>())).Verifiable();
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();
            var mockedMapper       = new Mock <IMapper>();

            var request = new Mock <HttpRequestBase>();
            //request.SetupGet(x => x.Headers).Returns(
            //    new WebHeaderCollection() {
            //        {"X-Requested-With", "XMLHttpRequest"}
            //    }
            //);
            var httpContext = new Mock <HttpContextBase>();

            httpContext.SetupGet(x => x.Request).Returns(request.Object);
            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            httpContext.SetupGet(x => x.User).Returns(principal.Object);
            controllerContext.SetupGet(x => x.HttpContext).Returns(httpContext.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ControllerContext = controllerContext.Object;

            //Act & Assert
            controller
            .WithCallTo(x => x.CancelFriendship(Guid.NewGuid()))
            .ShouldRedirectTo(typeof(IndividualController).GetMethod("ProfileDetails"))
            .WithRouteValue("username");
        }
示例#9
0
        public void CallMapMethod_WhenUsernameMatch()
        {
            var username = "******";
            var model    = new IndividualViewModel();

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetByUsername(username))
            .Returns(new SofiaDayAndNight.Data.Models.Individual());
            mockedIndividualService.Setup(x => x.GetStatus(It.IsAny <string>(), model.Id))
            .Returns(IndividualStatus.None);

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <IndividualViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Individual>()))
            .Returns(model);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ControllerContext = controllerContext.Object;

            // Act
            controller.ProfileDetails(username);

            // Assert
            mockedMapper.Verify(x => x.Map <IndividualViewModel>(
                                    It.IsAny <SofiaDayAndNight.Data.Models.Individual>()), Times.Once);
        }
示例#10
0
        public void ReturnBadRequest_WhenUsernameIsNull()
        {
            // Arrange
            var mockedIndividualService = new Mock <IIndividualService>();
            var mockedMapper            = new Mock <IMapper>();
            var mockedPhotoHelper       = new Mock <IPhotoHelper>();
            var mockedUserProvider      = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            //var username = "******";

            // Act & Assert
            controller
            .WithCallTo(x => x.FollowingList(null))
            .ShouldGiveHttpStatus(HttpStatusCode.BadRequest);
        }
        public void ReturnNotFoundRequest_WhenUserNotFound()
        {
            // Arrange
            var username  = "******";
            var user      = new User();
            var viewModel = new IndividualViewModel();
            var mockedIndividualService   = new Mock <IIndividualService>();
            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedPhotoHelper         = new Mock <IPhotoHelper>();
            var mockedUserProvider        = new Mock <IUserProvider>();

            mockedUserProvider.Setup(x => x.FindByName(It.IsAny <string>())).Returns((User)null);
            mockedUserProvider.Setup(x => x.Update(user)).Verifiable();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <SofiaDayAndNight.Data.Models.Individual>(It.IsAny <IndividualViewModel>()))
            .Returns(new SofiaDayAndNight.Data.Models.Individual());

            var mockedUpload = new Mock <HttpPostedFileBase>();

            var principal         = new Mock <IPrincipal>();
            var controllerContext = new Mock <ControllerContext>();

            principal.SetupGet(x => x.Identity.Name).Returns(username);
            controllerContext.SetupGet(x => x.HttpContext.User).Returns(principal.Object);

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            controller.ModelState.Clear();
            controller.ControllerContext = controllerContext.Object;

            //Act & Assert
            controller
            .WithCallTo(x => x.Submit(viewModel, mockedUpload.Object))
            .ShouldGiveHttpStatus(404);
        }
        public void ReturnViewWithCorrectCollection_WhenUsernameMatch()
        {
            //Arrange
            var username = "******";
            var model    = new IndividualViewModel();

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetFriendsRequests(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Individual>()
            {
                new SofiaDayAndNight.Data.Models.Individual()
            });

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <IndividualViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Individual>()))
            .Returns(model);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            //Act & Assert
            controller
            .WithCallTo(x => x.FriendsRequest(username))
            .ShouldRenderPartialView("_FriendsListPartial")
            .WithModel <IEnumerable <IndividualViewModel> >(c =>
            {
                Assert.AreEqual(1, c.Count());
                Assert.AreEqual(model.Id, c.First().Id);
            });
        }
示例#13
0
        public void ReturnViewWithCorrectModel_WhenUsernameMatch()
        {
            //Arrange
            var username   = "******";
            var individual = new OrganizationViewModel();

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetFollowingOrganization(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Organization>()
            {
                new SofiaDayAndNight.Data.Models.Organization()
            });

            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <OrganizationViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Organization>()))
            .Returns(individual);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            //Act & Assert
            controller
            .WithCallTo(x => x.FollowingList(username))
            .ShouldRenderPartialView("_OrganizationsListPartial")
            .WithModel <IEnumerable <OrganizationViewModel> >(model =>
            {
                Assert.AreEqual(1, model.Count());
                Assert.AreEqual(individual, model.First());
            });
        }
示例#14
0
        public void ReturnNotFoundRequest_WhenIdNotMatch()
        {
            var username = "******";
            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetByUsername(username)).Returns((SofiaDayAndNight.Data.Models.Individual)null);

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper       = new Mock <IMapper>();
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);


            // Act & Assert
            controller
            .WithCallTo(x => x.ProfileDetails(username))
            .ShouldGiveHttpStatus(404);
        }
        public void ReturnViewWithCorrectModel_WhenUsernameMatch()
        {
            //Arrange
            var username    = "******";
            var viewEvent   = new EventViewModel();
            var resultModel = new EventsListViewModel();

            resultModel.OngoingEvents = new List <EventViewModel>()
            {
                viewEvent
            };
            resultModel.UpCommingEvents = new List <EventViewModel>()
            {
                viewEvent
            };
            resultModel.PassedEvents = new List <EventViewModel>()
            {
                viewEvent
            };

            var mockedIndividualService = new Mock <IIndividualService>();

            mockedIndividualService.Setup(x => x.GetCurrentEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });
            mockedIndividualService.Setup(x => x.GetPassedEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });
            mockedIndividualService.Setup(x => x.GetUpcomingEvents(username))
            .Returns(new List <SofiaDayAndNight.Data.Models.Event>()
            {
                new SofiaDayAndNight.Data.Models.Event()
            });

            var mockedOrganizationService = new Mock <IOrganizationService>();
            var mockedMapper = new Mock <IMapper>();

            mockedMapper.Setup(x => x.Map <EventViewModel>(
                                   It.IsAny <SofiaDayAndNight.Data.Models.Event>()))
            .Returns(viewEvent);
            var mockedPhotoHelper  = new Mock <IPhotoHelper>();
            var mockedUserProvider = new Mock <IUserProvider>();

            var controller = new IndividualController(
                mockedIndividualService.Object,
                mockedMapper.Object,
                mockedPhotoHelper.Object,
                mockedUserProvider.Object);

            //Act & Assert
            controller
            .WithCallTo(x => x.EventsList(username))
            .ShouldRenderPartialView("_EventsListPartial")
            .WithModel <EventsListViewModel>(model =>
            {
                Assert.AreEqual(1, model.UpCommingEvents.Count());
                Assert.AreEqual(1, model.PassedEvents.Count());
                Assert.AreEqual(1, model.OngoingEvents.Count());
                Assert.AreEqual(viewEvent, model.UpCommingEvents.First());
                Assert.AreEqual(viewEvent, model.PassedEvents.First());
                Assert.AreEqual(viewEvent, model.OngoingEvents.First());
            });
        }
示例#16
0
        static void Main(string[] args)
        {
            IndividualController _individualController = new IndividualController();

            if (args.Length == 0)
            {
                Constants.Target = "Created by Alguek";
            }
            else
            {
                Constants.Target = args[0];
            }

            // Geração atual
            // Current generation
            int generation = 0;

            List <Individual> population = new List <Individual>();
            bool found = false;

            // Cria população inicial
            // Create initial population
            for (int i = 0; i < Constants.POPULATION_SIZE; i++)
            {
                string gnome = _individualController.CreateGnome();
                population.Add(new Individual(gnome));
            }

            while (!found)
            {
                // Ordena a população na ordem da Accuracy
                // Sort the population by the order of Accuracy score
                population = population.OrderByDescending(x => x.Accuracy).ToList();

                // Se o individual tem mais Accuracy do que o Target
                // significa que ele achou a melhor resposta
                // e o programa vai parar
                // if the individual having highness Accuracy score ie.
                // target size then we know that we have reached to the target
                // and break the loop
                if (population[0].Accuracy >= Constants.Target.Length)
                {
                    found = true;
                    break;
                }

                // Caso contrario cria uma nova geração de filhos
                // Otherwise generate new offsprings for new generation
                List <Individual> new_generation = new List <Individual>();

                // Pega apenas os melhores, apenas os 10% filhos com mais Accuracy da geração anterior
                // vai para a nova geração
                // Perform Elitism, that mean 10% of fittest population
                // goes to the next generation
                int s = (10 * Constants.POPULATION_SIZE) / 100;
                new_generation = population.GetRange(0, s);


                // Os 50% melhores da population vão dar "mate"
                // e criar novos filhos
                // From 50% of fittest population, Individuals
                // will mate to produce offspring
                s = (90 * Constants.POPULATION_SIZE) / 100;
                for (int i = 0; i < s; i++)
                {
                    int r1 = new Random((int)DateTime.Now.Ticks & 0x0000FFFF).Next(0, 50);
                    int r2 = new Random((int)DateTime.Now.Ticks & 0x0000FFFF).Next(0, 50);

                    Individual parent1 = population[r1];
                    Individual parent2 = population[r2];

                    Individual offspring = _individualController.Mate(parent1, parent2);

                    new_generation.Add(offspring);
                }

                population = new_generation;

                Console.WriteLine("Generation: " + generation + "\t");

                Console.WriteLine("String: " + population[0].Chromosome + "\t");

                Console.WriteLine("Fitness: " + population[0].Accuracy + "\t \n");

                generation++;
            }

            Console.WriteLine("Generation: " + generation + "\t");

            Console.WriteLine("String: " + population[0].Chromosome + "\t");

            Console.WriteLine("Fitness: " + population[0].Accuracy + "\t");
        }