Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1a19669fa | |||
| b3957c7f6b | |||
| c2d54081c2 | |||
| 4d3a771572 | |||
| e29ff7948e |
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.1.32319.34
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPropagation", "SharpPropagation\SharpPropagation.csproj", "{63900DDC-5D2A-44E7-AB35-241D3AFF1651}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPropagationTests1", "SharpPropagationTests1\SharpPropagationTests1.csproj", "{ADF53472-BD27-4602-AE07-3D8999CC5634}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -15,6 +17,10 @@ Global
|
||||
{63900DDC-5D2A-44E7-AB35-241D3AFF1651}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63900DDC-5D2A-44E7-AB35-241D3AFF1651}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63900DDC-5D2A-44E7-AB35-241D3AFF1651}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ADF53472-BD27-4602-AE07-3D8999CC5634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADF53472-BD27-4602-AE07-3D8999CC5634}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ADF53472-BD27-4602-AE07-3D8999CC5634}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADF53472-BD27-4602-AE07-3D8999CC5634}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SharpPropagation
|
||||
{
|
||||
internal class Disease
|
||||
public class Disease
|
||||
{
|
||||
const int MUTATION_TRAIT_INCREASE_PROPABILITY = 50;
|
||||
const int MUTATION_TRAIT_CHANGE_AMOUNT = 20;
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Drawing;
|
||||
|
||||
namespace SharpPropagation
|
||||
{
|
||||
internal class Human
|
||||
public class Human
|
||||
{
|
||||
public enum State { Normal, Infected, Dead, Immune };
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SharpPropagation
|
||||
private State presentState;
|
||||
|
||||
public Point Position { get => _position; set => _position = value; }
|
||||
internal State PresentState { get => presentState; set => presentState = value; }
|
||||
public State PresentState { get => presentState; set => presentState = value; }
|
||||
|
||||
public Human():this(new Point(0,0))
|
||||
{
|
||||
|
||||
+113
-100
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SharpPropagation
|
||||
{
|
||||
internal class Population
|
||||
public class Population
|
||||
{
|
||||
const int CORRECTED_PERCENTAGE = 101;
|
||||
|
||||
@@ -48,8 +48,9 @@ namespace SharpPropagation
|
||||
Rnd = rnd;
|
||||
Age = 0;
|
||||
Humans = new Human[dimensions.Width, dimensions.Height];
|
||||
|
||||
Console.WriteLine("Starting Generation");
|
||||
Generate();
|
||||
Console.WriteLine("Generation Finished");
|
||||
}
|
||||
|
||||
public void SetDisease(Disease plague)
|
||||
@@ -59,8 +60,10 @@ namespace SharpPropagation
|
||||
|
||||
public void Generate()
|
||||
{
|
||||
//Parallel.For(0, Dimensions.Width, x =>
|
||||
for (int x = 0; x < Dimensions.Width; x++)
|
||||
{
|
||||
//Parallel.For(0, Dimensions.Height, y =>
|
||||
for (int y = 0; y < Dimensions.Height; y++)
|
||||
{
|
||||
//The ratios will not be exact, for example someone who wants 100% infected 100% immune and 100% dead, he will have 100% dead because they are overwriting each others
|
||||
@@ -68,129 +71,112 @@ namespace SharpPropagation
|
||||
//Other thing, there will always be more of the last one because someone who is already infected for example could be then put to immune or dead
|
||||
//One solution to this issue would be to have if else else statements but in this case for example 20% would be lower with the last because its 20% on the remaining population and not of the all
|
||||
//In other words I did it that way but it can be changed just its not the right method to have perfect ratios
|
||||
if (StartInfectedRatio != 0)
|
||||
{
|
||||
if (StartInfectedRatio == 100 || Roll(Rnd, StartInfectedRatio))
|
||||
{
|
||||
Humans[x, y] = new Human(new Point(x, y), Human.State.Infected);
|
||||
}
|
||||
}
|
||||
if (StartImmuneRatio != 0)
|
||||
{
|
||||
if (StartImmuneRatio == 100 || Roll(Rnd, StartImmuneRatio))
|
||||
{
|
||||
Humans[x, y] = new Human(new Point(x, y), Human.State.Immune);
|
||||
}
|
||||
}
|
||||
if (StartDeadRatio != 0)
|
||||
{
|
||||
if (StartDeadRatio == 100 || Roll(Rnd, StartDeadRatio))
|
||||
{
|
||||
Humans[x, y] = new Human(new Point(x, y), Human.State.Dead);
|
||||
}
|
||||
}
|
||||
|
||||
if (Humans[x, y] is null)
|
||||
{
|
||||
Humans[x, y] = new Human(new Point(x, y), Human.State.Normal);
|
||||
}
|
||||
|
||||
if (Rnd.Next(0, CORRECTED_PERCENTAGE) < StartInfectedRatio)
|
||||
}//);
|
||||
}//);
|
||||
}
|
||||
public int[] Propagate()
|
||||
{
|
||||
Humans[x, y].PresentState = Human.State.Infected;
|
||||
}
|
||||
if (Rnd.Next(0, CORRECTED_PERCENTAGE) < StartImmuneRatio)
|
||||
{
|
||||
Humans[x, y].PresentState = Human.State.Immune;
|
||||
}
|
||||
if (Rnd.Next(0, CORRECTED_PERCENTAGE) < StartDeadRatio)
|
||||
{
|
||||
Humans[x, y].PresentState = Human.State.Dead;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public int[] GetStats()
|
||||
{
|
||||
int[] result;
|
||||
if (Humans != null)
|
||||
{
|
||||
int normalCount = 0;
|
||||
int infectedCount = 0;
|
||||
int immuneCount = 0;
|
||||
int deadCount = 0;
|
||||
|
||||
foreach (Human michel in Humans)
|
||||
{
|
||||
switch (michel.PresentState)
|
||||
{
|
||||
case Human.State.Normal:
|
||||
normalCount++;
|
||||
break;
|
||||
case Human.State.Infected:
|
||||
infectedCount++;
|
||||
break;
|
||||
case Human.State.Immune:
|
||||
immuneCount++;
|
||||
break;
|
||||
case Human.State.Dead:
|
||||
deadCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = new int[] { normalCount, infectedCount, immuneCount, deadCount };
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new int[] { 0, 0, 0, 0 };
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public void Propagate()
|
||||
{
|
||||
List<Human> peopleToCheck = new List<Human>();
|
||||
List<Point> peopleToCheck = new List<Point>();
|
||||
int[] stats = new int[] { 0, 0, 0, 0 };
|
||||
// 0 Normal, 1 Infected, 2 Immune, 3 Dead
|
||||
|
||||
//Parallel.For(0, Dimensions.Width,x =>
|
||||
for (int x = 0; x < Dimensions.Width; x++)
|
||||
{
|
||||
//Parallel.For(0, Dimensions.Width,y =>
|
||||
//Parallel.For(0, Dimensions.Height,y =>
|
||||
for (int y = 0; y < Dimensions.Height; y++)
|
||||
{
|
||||
switch (Humans[x, y].PresentState)
|
||||
{
|
||||
//for now only infected peoples are interesting
|
||||
case Human.State.Infected:
|
||||
peopleToCheck.Add(Humans[x, y]);
|
||||
case Human.State.Normal:
|
||||
stats[0]+=1;
|
||||
break;
|
||||
default:
|
||||
//do nothing
|
||||
case Human.State.Infected:
|
||||
peopleToCheck.Add(new Point(x,y));
|
||||
stats[1]+=1;
|
||||
break;
|
||||
case Human.State.Immune:
|
||||
stats[2] += 1;
|
||||
break;
|
||||
case Human.State.Dead:
|
||||
stats[3] += 1;
|
||||
break;
|
||||
}
|
||||
}//);
|
||||
}//);
|
||||
|
||||
List<Human> peopleToInfect = new List<Human>();
|
||||
List<Human> peopleToCure = new List<Human>();
|
||||
List<Human> peopleToKill = new List<Human>();
|
||||
List<Point> peopleToInfect = new List<Point>();
|
||||
List<Point> peopleToCure = new List<Point>();
|
||||
List<Point> peopleToKill = new List<Point>();
|
||||
|
||||
//Parallel.ForEach(peopleToCheck, person =>
|
||||
foreach (Human person in peopleToCheck)
|
||||
foreach (Point person in peopleToCheck)
|
||||
{
|
||||
//I am assuming that if the Human is Curing or dying on this tick, he cant infect anyone
|
||||
if (wouldCure(Rnd))
|
||||
if (Roll(Rnd,Plague.CuringRate))
|
||||
{
|
||||
peopleToCure.Add(person);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wouldDie(Rnd))
|
||||
if (Roll(Rnd,Plague.DeathRate))
|
||||
{
|
||||
peopleToKill.Add(person);
|
||||
}
|
||||
else
|
||||
{
|
||||
//now we can start to check if people would be infected or not
|
||||
if (person.Position.X > 0 && person.Position.X < Dimensions.Width -1 && person.Position.Y > 0 && person.Position.Y < Dimensions.Height -1)
|
||||
if (person.X > 0 && person.X < Dimensions.Width - 1 && person.Y > 0 && person.Y < Dimensions.Height - 1)
|
||||
{
|
||||
/// ###
|
||||
/// #@#
|
||||
/// ###
|
||||
|
||||
List<Human> potentialInfections = new List<Human>();
|
||||
//potentialInfections.Add(Humans[person.Position.X,person.Position.Y]);
|
||||
List<Point> potentialInfections = new List<Point>();
|
||||
|
||||
potentialInfections.Add(Humans[person.Position.X - 1, person.Position.Y - 1]); //Top Left
|
||||
potentialInfections.Add(Humans[person.Position.X, person.Position.Y - 1]); //Top
|
||||
potentialInfections.Add(Humans[person.Position.X + 1, person.Position.Y - 1]); //Top Right
|
||||
potentialInfections.Add(new Point(person.X - 1, person.Y - 1)); //Top Left
|
||||
potentialInfections.Add(new Point(person.X, person.Y - 1)); //Top
|
||||
potentialInfections.Add(new Point(person.X + 1, person.Y - 1)); //Top Right
|
||||
|
||||
potentialInfections.Add(Humans[person.Position.X - 1, person.Position.Y]); //Left
|
||||
potentialInfections.Add(Humans[person.Position.X + 1, person.Position.Y]); //Right
|
||||
potentialInfections.Add(new Point(person.X - 1, person.Y)); //Left
|
||||
potentialInfections.Add(new Point(person.X + 1, person.Y)); //Right
|
||||
|
||||
potentialInfections.Add(Humans[person.Position.X - 1, person.Position.Y + 1]); //Bottom Left
|
||||
potentialInfections.Add(Humans[person.Position.X, person.Position.Y + 1]); //Bottom
|
||||
potentialInfections.Add(Humans[person.Position.X + 1, person.Position.Y + 1]); //Bottom Right
|
||||
potentialInfections.Add(new Point(person.X - 1, person.Y + 1)); //Bottom Left
|
||||
potentialInfections.Add(new Point(person.X, person.Y + 1)); //Bottom
|
||||
potentialInfections.Add(new Point(person.X + 1, person.Y + 1)); //Bottom Right
|
||||
|
||||
foreach (Human potentialInfected in potentialInfections)
|
||||
foreach (Point potentialInfected in potentialInfections)
|
||||
{
|
||||
if (wouldBeInfected(Rnd))
|
||||
if (Humans[potentialInfected.X,potentialInfected.Y].PresentState == Human.State.Normal)
|
||||
{
|
||||
if (potentialInfected.PresentState == Human.State.Normal)
|
||||
if (Roll(Rnd,Plague.InfectionRate))
|
||||
{
|
||||
peopleToInfect.Add(potentialInfected);
|
||||
}
|
||||
@@ -244,55 +230,82 @@ namespace SharpPropagation
|
||||
if (peopleToInfect.Count > 0)
|
||||
{
|
||||
//Parallel.ForEach(peopleToInfect, infected =>
|
||||
foreach (Human infected in peopleToInfect)
|
||||
foreach (Point infected in peopleToInfect)
|
||||
{
|
||||
Humans[infected.Position.X, infected.Position.Y].PresentState = Human.State.Infected;
|
||||
Humans[infected.X, infected.Y].PresentState = Human.State.Infected;
|
||||
}//);
|
||||
}
|
||||
if (peopleToCure.Count > 0)
|
||||
{
|
||||
//Parallel.ForEach(peopleToCure, cured =>
|
||||
foreach (Human cured in peopleToCure)
|
||||
foreach (Point cured in peopleToCure)
|
||||
{
|
||||
Humans[cured.Position.X, cured.Position.Y].PresentState = Human.State.Immune;
|
||||
Humans[cured.X, cured.Y].PresentState = Human.State.Immune;
|
||||
}//);
|
||||
}
|
||||
if (peopleToKill.Count > 0)
|
||||
{
|
||||
//Parallel.ForEach(peopleToKill, dead =>
|
||||
foreach (Human dead in peopleToKill)
|
||||
foreach (Point dead in peopleToKill)
|
||||
{
|
||||
Humans[dead.Position.X, dead.Position.Y].PresentState = Human.State.Dead;
|
||||
Humans[dead.X, dead.Y].PresentState = Human.State.Dead;
|
||||
}//);
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
public bool wouldBeInfected(Random rnd)
|
||||
public bool Roll(Random rnd,int rate)
|
||||
{
|
||||
return rnd.Next(0, CORRECTED_PERCENTAGE) < Plague.InfectionRate;
|
||||
return rnd.Next(0, CORRECTED_PERCENTAGE) < rate;
|
||||
}
|
||||
public bool wouldCure(Random rnd)
|
||||
public void DisplayPng(string name)
|
||||
{
|
||||
//You could add a modifier that increases the curing chance with the age of the disease in the Human
|
||||
//Like after 2 weeks with it it would be at least 5 times more likely for him to cure
|
||||
return rnd.Next(0, CORRECTED_PERCENTAGE) < Plague.CuringRate;
|
||||
Bitmap bitmap = new Bitmap(Dimensions.Width,Dimensions.Height);
|
||||
Color color = new Color();
|
||||
using (Graphics g = Graphics.FromImage(bitmap))
|
||||
{
|
||||
//Parallel.For(0, Dimensions.Width, x =>
|
||||
for (int x = 0; x < Dimensions.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < Dimensions.Height; y++)
|
||||
{
|
||||
|
||||
switch (Humans[x, y].PresentState)
|
||||
{
|
||||
case Human.State.Normal:
|
||||
color = Color.Green;
|
||||
break;
|
||||
case Human.State.Infected:
|
||||
color = Color.Red;
|
||||
break;
|
||||
case Human.State.Immune:
|
||||
color = Color.Blue;
|
||||
break;
|
||||
case Human.State.Dead:
|
||||
color = Color.Black;
|
||||
break;
|
||||
}
|
||||
public bool wouldDie(Random rnd)
|
||||
{
|
||||
return rnd.Next(0, CORRECTED_PERCENTAGE) < Plague.DeathRate;
|
||||
bitmap.SetPixel(x, y, color);
|
||||
}
|
||||
}//);
|
||||
}
|
||||
bitmap.Save(name + ".png",System.Drawing.Imaging.ImageFormat.Png);
|
||||
}
|
||||
public void Display()
|
||||
{
|
||||
int[] stats = GetStats();
|
||||
//int[] stats = GetStats();
|
||||
char sprite = '#';
|
||||
//Console.Clear();
|
||||
Console.WriteLine(String.Format("Population aged {0}", Age));
|
||||
Console.WriteLine(String.Format("Population : {0} Normals : {1} Infecteds : {2} Immunes : {3} Deads : {4}", Humans.Length, stats[0], stats[1], stats[2], stats[3]));
|
||||
//Console.WriteLine(String.Format("Population : {0} Normals : {1} Infecteds : {2} Immunes : {3} Deads : {4}", Humans.Length, stats[0], stats[1], stats[2], stats[3]));
|
||||
if (Plague != null)
|
||||
Console.WriteLine(Plague);
|
||||
Console.Write("\n");
|
||||
|
||||
//Parallel.For(0, Dimensions.Width, x =>
|
||||
for (int x = 0; x < Dimensions.Width; x++)
|
||||
{
|
||||
Console.Write("\n");
|
||||
//Parallel.For(0, Dimensions.height, y =>
|
||||
for (int y = 0; y < Dimensions.Height; y++)
|
||||
{
|
||||
switch (Humans[x, y].PresentState)
|
||||
@@ -321,8 +334,8 @@ namespace SharpPropagation
|
||||
Console.Write(sprite);
|
||||
//We reset to the default
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
}
|
||||
}
|
||||
}//);
|
||||
}//);
|
||||
Console.Write(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
+26
-14
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpPropagation
|
||||
{
|
||||
@@ -14,25 +15,36 @@ namespace SharpPropagation
|
||||
{
|
||||
Console.WriteLine("********** Sharp Propagation (Console) 2022 **********");
|
||||
Random random = new Random();
|
||||
|
||||
Population peoples = new Population(new Size(30,50),random,10,10,5);
|
||||
Size populationSize = new Size(1000,1000);
|
||||
Population peoples = new Population(populationSize,random,10,10,5);
|
||||
peoples.SetDisease(new Disease(random,20,10,5,"Chick Chicken"));
|
||||
Console.WriteLine("Before Propagation");
|
||||
peoples.Display();
|
||||
string ImagesLocation = "./Test/";
|
||||
//peoples.Display();
|
||||
|
||||
int[] stats = peoples.GetStats();
|
||||
// 0:normal 1:infected
|
||||
int test = 1;
|
||||
while (stats[1] > 5 && test < 60)
|
||||
// If the directory does not exist, create it
|
||||
if (!Directory.Exists(ImagesLocation))
|
||||
{
|
||||
Console.Clear();
|
||||
peoples.Propagate();
|
||||
peoples.Display();
|
||||
test++;
|
||||
//Thread.Sleep(200);
|
||||
Directory.CreateDirectory(ImagesLocation);
|
||||
}
|
||||
|
||||
Console.ReadKey();
|
||||
Console.WriteLine($"Propagation started with {populationSize.Width} x {populationSize.Height} humans ({populationSize.Width*populationSize.Height})");
|
||||
int[] stats;
|
||||
int steps = 0;
|
||||
// 0:normal 1:infected
|
||||
while(true)
|
||||
{
|
||||
steps++;
|
||||
stats = peoples.Propagate();
|
||||
Console.WriteLine($"Infecteds: {stats[1]} Immunes: {stats[2]} Deads: {stats[3]}");
|
||||
if (stats[1] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
peoples.DisplayPng(ImagesLocation+"Test_"+steps);
|
||||
}
|
||||
//peoples.Display();
|
||||
Console.WriteLine($"Propagation finished in {steps}");
|
||||
//Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpPropagation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpPropagation.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class PopulationTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void PopulationTest()
|
||||
{
|
||||
Size dimensions = new Size(30, 40);
|
||||
Random rnd = new Random();
|
||||
int startInfectedRatio = 20;
|
||||
int startImmuneRatio = 30;
|
||||
int startDeadRatio = 40;
|
||||
|
||||
Population target = new Population(dimensions,rnd,startInfectedRatio,startImmuneRatio,startDeadRatio);
|
||||
|
||||
Assert.AreEquals(target.Dimensions.Width = dimensions.Width);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PopulationTest1()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PopulationTest2()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void SetDiseaseTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void GenerateTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PropagateTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void RollTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void DisplayPngTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void DisplayTest()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SharpPropagationTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SharpPropagationTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("578e37b9-3231-45cd-86ea-57d2b468c6ba")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{578E37B9-3231-45CD-86EA-57D2B468C6BA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpPropagationTests</RootNamespace>
|
||||
<AssemblyName>SharpPropagationTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise />
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="PopulationTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpPropagation\SharpPropagation.csproj">
|
||||
<Project>{63900DDC-5D2A-44E7-AB35-241D3AFF1651}</Project>
|
||||
<Name>SharpPropagation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.2.7" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.2.7" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -0,0 +1,227 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpPropagation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharpPropagation.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class PopulationTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void PopulationTest()
|
||||
{
|
||||
Size dimensions = new Size(30, 30);
|
||||
Random rnd = new Random();
|
||||
int startInfectedRatio = 10;
|
||||
int startImmuneRatio = 20;
|
||||
int startDeadRatio = 30;
|
||||
|
||||
Population target = new Population(dimensions,rnd,startInfectedRatio,startImmuneRatio,startDeadRatio);
|
||||
|
||||
Assert.AreEqual(dimensions.Width,target.Dimensions.Width);
|
||||
Assert.AreEqual(dimensions.Height, target.Dimensions.Height);
|
||||
Assert.AreEqual(rnd,target.Rnd);
|
||||
Assert.AreEqual(startInfectedRatio,target.StartInfectedRatio);
|
||||
Assert.AreEqual(startImmuneRatio,target.StartImmuneRatio);
|
||||
Assert.AreEqual(startDeadRatio,target.StartDeadRatio);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void SetDiseaseTest()
|
||||
{
|
||||
Random rnd = new Random();
|
||||
int infectionRate = 10;
|
||||
int curingRate = 20;
|
||||
int deathRate = 30;
|
||||
string name = "TuPeuxPasTest";
|
||||
Disease plague = new Disease(rnd,infectionRate,curingRate,deathRate,name);
|
||||
|
||||
Assert.AreEqual(name, plague.Name);
|
||||
Assert.AreEqual(rnd, plague.Rnd);
|
||||
Assert.AreEqual(infectionRate, plague.InfectionRate);
|
||||
Assert.AreEqual(curingRate, plague.CuringRate);
|
||||
Assert.AreEqual(deathRate, plague.DeathRate);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void GenerateWith0PercentTest()
|
||||
{
|
||||
int width = 20;
|
||||
int height = 30;
|
||||
Population target = new Population(new Size(width,height),new Random(),0,0,0);
|
||||
|
||||
for (int x = 0; x < width;x ++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
Human.State expectedState = Human.State.Normal;
|
||||
Assert.AreEqual(expectedState,target.Humans[x,y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void GenerateWith100InfectionTest()
|
||||
{
|
||||
int width = 20;
|
||||
int height = 30;
|
||||
Population target = new Population(new Size(width, height), new Random(),100, 0, 0);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
Human.State expectedState = Human.State.Infected;
|
||||
Assert.AreEqual(expectedState, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void GenerateWith100ImmuneTest()
|
||||
{
|
||||
int width = 20;
|
||||
int height = 30;
|
||||
Population target = new Population(new Size(width, height), new Random(), 0, 100, 0);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
Human.State expectedState = Human.State.Immune;
|
||||
Assert.AreEqual(expectedState, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void GenerateWith100DeadTest()
|
||||
{
|
||||
int width = 20;
|
||||
int height = 30;
|
||||
Population target = new Population(new Size(width, height), new Random(), 0, 0, 100);
|
||||
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
Human.State expectedState = Human.State.Dead;
|
||||
Assert.AreEqual(expectedState, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void Propagate100InfectionTest()
|
||||
{
|
||||
Human[,] testArray = new Human[3, 3];
|
||||
|
||||
// 000
|
||||
// 010
|
||||
// 000
|
||||
|
||||
testArray[0, 0] = new Human(new Point(0, 0),Human.State.Normal);
|
||||
testArray[1, 0] = new Human(new Point(1, 0), Human.State.Normal);
|
||||
testArray[2, 0] = new Human(new Point(2, 0), Human.State.Normal);
|
||||
|
||||
testArray[0, 1] = new Human(new Point(0, 1), Human.State.Normal);
|
||||
testArray[1, 1] = new Human(new Point(1, 1), Human.State.Infected); //infected
|
||||
testArray[2, 1] = new Human(new Point(2, 1), Human.State.Normal);
|
||||
|
||||
testArray[0, 2] = new Human(new Point(0, 2), Human.State.Normal);
|
||||
testArray[1, 2] = new Human(new Point(1, 2), Human.State.Normal);
|
||||
testArray[2, 2] = new Human(new Point(2, 2), Human.State.Normal);
|
||||
|
||||
Population target = new Population(new Size(3,3),new Random(),0,0,0);
|
||||
Disease plague = new Disease(new Random(), 100, 0, 0, "Covid 32");
|
||||
target.SetDisease(plague);
|
||||
target.Humans = testArray;
|
||||
|
||||
|
||||
target.Propagate();
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Assert.AreEqual(Human.State.Infected, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void Propagate100CureTest()
|
||||
{
|
||||
Human[,] testArray = new Human[3, 3];
|
||||
|
||||
// 000
|
||||
// 010
|
||||
// 000
|
||||
|
||||
testArray[0, 0] = new Human(new Point(0, 0), Human.State.Infected);
|
||||
testArray[1, 0] = new Human(new Point(1, 0), Human.State.Infected);
|
||||
testArray[2, 0] = new Human(new Point(2, 0), Human.State.Infected);
|
||||
|
||||
testArray[0, 1] = new Human(new Point(0, 1), Human.State.Infected);
|
||||
testArray[1, 1] = new Human(new Point(1, 1), Human.State.Infected); //infected
|
||||
testArray[2, 1] = new Human(new Point(2, 1), Human.State.Infected);
|
||||
|
||||
testArray[0, 2] = new Human(new Point(0, 2), Human.State.Infected);
|
||||
testArray[1, 2] = new Human(new Point(1, 2), Human.State.Infected);
|
||||
testArray[2, 2] = new Human(new Point(2, 2), Human.State.Infected);
|
||||
|
||||
Population target = new Population(new Size(3, 3), new Random(), 0, 0, 0);
|
||||
Disease plague = new Disease(new Random(), 0,100, 0, "Covid 32");
|
||||
target.SetDisease(plague);
|
||||
target.Humans = testArray;
|
||||
|
||||
|
||||
target.Propagate();
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Assert.AreEqual(Human.State.Immune, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void Propagate100DeathTest()
|
||||
{
|
||||
Human[,] testArray = new Human[3, 3];
|
||||
|
||||
// 000
|
||||
// 010
|
||||
// 000
|
||||
|
||||
testArray[0, 0] = new Human(new Point(0, 0), Human.State.Infected);
|
||||
testArray[1, 0] = new Human(new Point(1, 0), Human.State.Infected);
|
||||
testArray[2, 0] = new Human(new Point(2, 0), Human.State.Infected);
|
||||
|
||||
testArray[0, 1] = new Human(new Point(0, 1), Human.State.Infected);
|
||||
testArray[1, 1] = new Human(new Point(1, 1), Human.State.Infected); //infected
|
||||
testArray[2, 1] = new Human(new Point(2, 1), Human.State.Infected);
|
||||
|
||||
testArray[0, 2] = new Human(new Point(0, 2), Human.State.Infected);
|
||||
testArray[1, 2] = new Human(new Point(1, 2), Human.State.Infected);
|
||||
testArray[2, 2] = new Human(new Point(2, 2), Human.State.Infected);
|
||||
|
||||
Population target = new Population(new Size(3, 3), new Random(), 0, 0, 0);
|
||||
Disease plague = new Disease(new Random(), 0, 0, 100, "Covid 32");
|
||||
target.SetDisease(plague);
|
||||
target.Humans = testArray;
|
||||
|
||||
|
||||
target.Propagate();
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Assert.AreEqual(Human.State.Dead, target.Humans[x, y].PresentState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SharpPropagationTests1")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SharpPropagationTests1")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("adf53472-bd27-4602-ae07-3d8999cc5634")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{ADF53472-BD27-4602-AE07-3D8999CC5634}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpPropagationTests1</RootNamespace>
|
||||
<AssemblyName>SharpPropagationTests1</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise />
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="PopulationTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpPropagation\SharpPropagation.csproj">
|
||||
<Project>{63900DDC-5D2A-44E7-AB35-241D3AFF1651}</Project>
|
||||
<Name>SharpPropagation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.2.7" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.2.7" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user