diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..946c963 Binary files /dev/null and b/.DS_Store differ diff --git a/FifthLesson/readme.md b/FifthLesson/readme.md deleted file mode 100644 index 1db0aa3..0000000 --- a/FifthLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -Fifth lesson of Margelov Vitaly \ No newline at end of file diff --git a/FirstLesson/readme.md b/FirstLesson/readme.md deleted file mode 100644 index d135227..0000000 --- a/FirstLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -First lesson of Margelov Vitaly \ No newline at end of file diff --git a/ForthLesson/readme.md b/ForthLesson/readme.md deleted file mode 100644 index 4681cff..0000000 --- a/ForthLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -Forth lesson of Margelov Vitaly \ No newline at end of file diff --git a/RentCars/RentCars.sln b/RentCars/RentCars.sln new file mode 100644 index 0000000..599b386 --- /dev/null +++ b/RentCars/RentCars.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RentCars", "RentCars\RentCars.csproj", "{106C5519-D955-40F3-A4AA-F6229D9E29FB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RentCarsTest", "RentCarsTest\RentCarsTest.csproj", "{E3641E35-A492-4547-8D91-FA311E841C38}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {106C5519-D955-40F3-A4AA-F6229D9E29FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {106C5519-D955-40F3-A4AA-F6229D9E29FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {106C5519-D955-40F3-A4AA-F6229D9E29FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {106C5519-D955-40F3-A4AA-F6229D9E29FB}.Release|Any CPU.Build.0 = Release|Any CPU + {E3641E35-A492-4547-8D91-FA311E841C38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3641E35-A492-4547-8D91-FA311E841C38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3641E35-A492-4547-8D91-FA311E841C38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3641E35-A492-4547-8D91-FA311E841C38}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/RentCars/RentCars/AdminFacade.cs b/RentCars/RentCars/AdminFacade.cs new file mode 100644 index 0000000..8e847cd --- /dev/null +++ b/RentCars/RentCars/AdminFacade.cs @@ -0,0 +1,21 @@ +using System; +namespace RentCars +{ + public class AdminFacade + { + string Name { get; } + public AdminFacade(string name) + { + Name = name; + } + public void AddCar(Car car, CarPark carPark) + { + carPark.AddCarToPark(car, carPark); + } + public Rent CreateNewRent(Car rentedcar, Costumer costumerrenting, Interval rentedinterval) + { + var NewRent = new Rent(rentedcar, costumerrenting, rentedinterval); + return NewRent; + } + } +} diff --git a/RentCars/RentCars/Car.cs b/RentCars/RentCars/Car.cs new file mode 100644 index 0000000..c8cf06e --- /dev/null +++ b/RentCars/RentCars/Car.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; + +namespace RentCars +{ + public class Car + { + public string Id { get; } + public int RentCounter { get; set; } + public List RentedIntervals { get; set; } + + public Car(string id) + { + Id = id; + RentCounter = new int(); + RentedIntervals = new List(); + } + public bool CheckMaintenance() + { + bool Maintenance; + if (RentCounter <= 10) + { + Maintenance = true; + return Maintenance; + } + else + { + Maintenance = false; + return Maintenance; + } + } + + public void DoMaintenance(Interval Dayofstart) + { + Dayofstart.MaintenanceInterval(); + RentedIntervals.Add(Dayofstart); + + + } + + public bool Disponibility(Interval IntentionalInterval) + { + + bool Disponible = true; + + for (int i = 0; i < RentedIntervals.Count; i++) + { + if (RentedIntervals[i].TimeIntervalChecker(IntentionalInterval) != true) + { + + return Disponible = false; + + } + + } + + return Disponible; + + + } + + } + +} diff --git a/RentCars/RentCars/CarPark.cs b/RentCars/RentCars/CarPark.cs new file mode 100644 index 0000000..f0474f7 --- /dev/null +++ b/RentCars/RentCars/CarPark.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; + +namespace RentCars +{ + public class CarPark + { + public List AvaiableCars {get; set; } + public List TotalCars { get; set; } + + public CarPark(){ + + + AvaiableCars = new List(); + TotalCars = new List(); + + } + public void AddCarToPark(Car carToAdd, CarPark carPark) + { + carPark.TotalCars.Add(carToAdd); + } + + public List CheckDisponibilityOfCarsOnSpecificInterval(Interval Intended ){ + bool avaiable; + for (int i = 0; i < TotalCars.Count; i++) + { + avaiable = true; + for (int j = 0; j < TotalCars[i].RentedIntervals.Count; j++) + { + + avaiable = TotalCars[i].RentedIntervals[j].TimeIntervalChecker(Intended); + + } + if (avaiable == true) + { + + AvaiableCars.Add(TotalCars[i].Id); + + } + } + return AvaiableCars; + + + } + public List ShowAvaiableCars(){ + + for (int i = 0; i < AvaiableCars.Count; i++) + { + Console.WriteLine(AvaiableCars[i]); + } + return AvaiableCars; + } + + + + } +} diff --git a/RentCars/RentCars/Costumer.cs b/RentCars/RentCars/Costumer.cs new file mode 100644 index 0000000..c01b858 --- /dev/null +++ b/RentCars/RentCars/Costumer.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace RentCars +{ + public class Costumer + { + public string CostumerID { get; } + public List RentHistory { get; set; } + public List Rents { get; set; } + + public Costumer(string costumerid) + { + CostumerID = costumerid; + RentHistory = new List(); + Rents = new List(); + } + + public void ShowCostumerHistory(){ + for (int i = 0; i < RentHistory.Count; i++) + { + Console.WriteLine(RentHistory[i]); + } + } + + } +} diff --git a/RentCars/RentCars/Interval.cs b/RentCars/RentCars/Interval.cs new file mode 100644 index 0000000..98bfbef --- /dev/null +++ b/RentCars/RentCars/Interval.cs @@ -0,0 +1,39 @@ +using System; +namespace RentCars +{ + public class Interval + { + + public DateTimeOffset Date1 { get; set; } + public DateTimeOffset Date2 { get; set; } + + public Interval(DateTimeOffset date1, DateTimeOffset date2) + { + + Date1 = date1; + Date2 = date2; + } + + public bool TimeIntervalChecker(Interval IntervalToCheck ) + { + bool Result = false; + if(DateTimeOffset.Compare(Date1, IntervalToCheck.Date1) > 0 && DateTimeOffset.Compare(Date1, IntervalToCheck.Date2) > 0){ + Result = true; + }if(DateTimeOffset.Compare(Date2, IntervalToCheck.Date1) < 0 && DateTimeOffset.Compare(Date2, IntervalToCheck.Date1) < 0) + { + Result = true; + } + return Result; + } + + + public Interval MaintenanceInterval(){ + Date2 = Date2.AddDays(7); + var TenDaysInterval = new Interval(Date1, Date2); + return TenDaysInterval; + } + + + + } +} diff --git a/RentCars/RentCars/Program.cs b/RentCars/RentCars/Program.cs new file mode 100644 index 0000000..d4aadbb --- /dev/null +++ b/RentCars/RentCars/Program.cs @@ -0,0 +1,11 @@ +using System; +namespace RentCars +{ + public class Program + { + public static void Main(string[] args) + { + + } + } +} diff --git a/RentCars/RentCars/Rent.cs b/RentCars/RentCars/Rent.cs new file mode 100644 index 0000000..e588200 --- /dev/null +++ b/RentCars/RentCars/Rent.cs @@ -0,0 +1,34 @@ +using System; +namespace RentCars +{ + public class Rent + { + public Car RentedCar { set; get; } + public Costumer CostumerRenting { set; get; } + public Interval RentedInterval { get; set; } + + public Rent(Car rentedcar, Costumer costumerrenting, Interval rentedinterval) + { + + RentedCar = rentedcar; + CostumerRenting = costumerrenting; + RentedInterval = rentedinterval; + + if (RentedCar.Disponibility(RentedInterval) & RentedCar.CheckMaintenance()) + { + CostumerRenting.Rents.Add(RentedInterval); + CostumerRenting.RentHistory.Add(RentedCar.Id); + RentedCar.RentCounter++; + + } + if (RentedCar.CheckMaintenance() == false) + { + RentedCar.DoMaintenance(RentedInterval); + Console.WriteLine("Cannot rent this car is going to Maintenance"); + }else { + Console.WriteLine("Can not rent this car, it is going to Maintenance"); + + } + } + } +} diff --git a/RentCars/RentCars/RentCars.csproj b/RentCars/RentCars/RentCars.csproj new file mode 100644 index 0000000..f48c46a --- /dev/null +++ b/RentCars/RentCars/RentCars.csproj @@ -0,0 +1,21 @@ + + + + Exe + netcoreapp2.1 + + + + + + + + + + + + + + + + diff --git a/RentCars/RentCars/UserFacade.cs b/RentCars/RentCars/UserFacade.cs new file mode 100644 index 0000000..cc42a8d --- /dev/null +++ b/RentCars/RentCars/UserFacade.cs @@ -0,0 +1,24 @@ +using System; +namespace RentCars +{ + public class UserFacade + { + public Costumer Costumer { get; } + + public UserFacade(Costumer costumer) + { + Costumer = costumer; + } + public void ShowCostumerHistory(){ + + Costumer.ShowCostumerHistory(); + + } + public Rent CreateNewRent(Car rentedcar, Costumer costumerrenting, Interval rentedinterval) + { + var NewRent = new Rent(rentedcar, costumerrenting, rentedinterval); + return NewRent; + } + + } +} diff --git a/RentCars/RentCarsTest/CarParkTest.cs b/RentCars/RentCarsTest/CarParkTest.cs new file mode 100644 index 0000000..32c8c4f --- /dev/null +++ b/RentCars/RentCarsTest/CarParkTest.cs @@ -0,0 +1,52 @@ +using System; +using Xunit; +using RentCars; +using System.Collections.Generic; + +namespace RentCarsTest +{ + public class CarParkTest + { + [Fact] + public void AddCarToPark() + { + // Arrange + var Admin = new AdminFacade("Daniel"); + var newCar = new Car("Red"); + var newCarPark = new CarPark(); + // Act + Admin.AddCar(newCar, newCarPark); + var expected = new List(); + expected.Add(newCar); + //Asert + newCarPark.ShowAvaiableCars(); + Assert.True(expected[0] == newCarPark.TotalCars[0]); + + } + [Fact] + public void CheckDisponibilityOfCarsOnSpecificIntervalTestNotCoorrectDates(){ + + //Arrange + DateTimeOffset date1 = new DateTimeOffset(2018, 10, 1, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date2 = new DateTimeOffset(2018, 10, 10, 0, 0, 0, DateTimeOffset.Now.Offset); + var firstInterval = new Interval(date1, date2); + DateTimeOffset date3 = new DateTimeOffset(2018, 11, 11, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date4 = new DateTimeOffset(2018, 11, 20, 0, 0, 0, DateTimeOffset.Now.Offset); + var secondInterval = new Interval(date3, date4); + var Admin = new AdminFacade("Daniel"); + var newCar = new Car("Red"); + var newCarPark = new CarPark(); + newCar.RentedIntervals.Add(firstInterval); + //Act + Admin.AddCar(newCar, newCarPark); + List result = newCarPark.CheckDisponibilityOfCarsOnSpecificInterval(secondInterval); + var expected = new List(); + expected.Add(newCar.Id); + //Assert + Assert.True(expected[0] == result[0]); + } + + + + } +} diff --git a/RentCars/RentCarsTest/CarTest.cs b/RentCars/RentCarsTest/CarTest.cs new file mode 100644 index 0000000..f728825 --- /dev/null +++ b/RentCars/RentCarsTest/CarTest.cs @@ -0,0 +1,30 @@ +using System; +using RentCars; +using Xunit; + +namespace RentCarsTest +{ + + public class CarTest + { + + [Fact] + public void CheckMaintenance() + { + // Arrange + var newCar = new Car("Red"); + // Act + DateTimeOffset date1 = new DateTimeOffset(2018, 11, 1, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date2 = new DateTimeOffset(2018, 11, 10, 0, 0, 0, DateTimeOffset.Now.Offset); + var firstInterval = new Interval(date1, date2); + newCar.RentCounter = newCar.RentCounter + 10; + bool result = newCar.CheckMaintenance(); + bool expected = true; + //Asert + Assert.True(result == expected); + } + + + + } +} diff --git a/RentCars/RentCarsTest/IntervalLogicTest.cs b/RentCars/RentCarsTest/IntervalLogicTest.cs new file mode 100644 index 0000000..f40f9b3 --- /dev/null +++ b/RentCars/RentCarsTest/IntervalLogicTest.cs @@ -0,0 +1,44 @@ +using System; +using RentCars; +using Xunit; +namespace RentCarsTest +{ + public class IntervalLogicTest + { + [Fact] + public void TimeIntervalInterfereTest() + { + // Arrange + DateTimeOffset date1 = new DateTimeOffset(2018, 10, 1, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date2 = new DateTimeOffset(2018, 10, 10, 0, 0, 0, DateTimeOffset.Now.Offset); + var firstInterval = new Interval(date1, date2); + DateTimeOffset date3 = new DateTimeOffset(2018, 10, 3, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date4 = new DateTimeOffset(2018, 10, 20, 0, 0, 0, DateTimeOffset.Now.Offset); + var secondInterval = new Interval(date3, date4); + // Act + bool result = firstInterval.TimeIntervalChecker(secondInterval); + // Assert + Assert.False(result); + } + [Fact] + public void AddMaintainanceInterval( ){ + // Arrange + DateTimeOffset date1 = new DateTimeOffset(2018, 10, 1, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date2 = new DateTimeOffset(2018, 10, 10, 0, 0, 0, DateTimeOffset.Now.Offset); + var firstInterval = new Interval(date1, date2); + //Act + firstInterval.MaintenanceInterval(); + DateTimeOffset expected = new DateTimeOffset(2018, 10, 17, 0, 0, 0, DateTimeOffset.Now.Offset); + //Assert + bool result; + if(expected == firstInterval.Date2){ + result = true; + }else{ + result = false; + } + Assert.True(result); + + + } + } +} \ No newline at end of file diff --git a/RentCars/RentCarsTest/RentCarsTest.csproj b/RentCars/RentCarsTest/RentCarsTest.csproj new file mode 100644 index 0000000..7e53c9f --- /dev/null +++ b/RentCars/RentCarsTest/RentCarsTest.csproj @@ -0,0 +1,22 @@ + + + + netcoreapp2.1 + + false + + + + + + + + + + + + + + + + diff --git a/RentCars/RentCarsTest/RentTest.cs b/RentCars/RentCarsTest/RentTest.cs new file mode 100644 index 0000000..b873658 --- /dev/null +++ b/RentCars/RentCarsTest/RentTest.cs @@ -0,0 +1,28 @@ +using System; +using RentCars; +using Xunit; +namespace RentCarsTest +{ + public class RentTest + { + [Fact] + public void CreateRentTest() + { + // Arrange + DateTimeOffset date1 = new DateTimeOffset(2018, 10, 1, 0, 0, 0, DateTimeOffset.Now.Offset); + DateTimeOffset date2 = new DateTimeOffset(2018, 10, 10, 0, 0, 0, DateTimeOffset.Now.Offset); + var firstInterval = new Interval(date1, date2); + var newCar = new Car("Red"); + var NewCostumer = new Costumer("CostumerName"); + // Act + var NewRent = new Rent(newCar, NewCostumer, firstInterval); + bool result = false; + if(NewRent.RentedCar.Id == "Red" && NewRent.CostumerRenting.CostumerID == "CostumerName"){ + result = true; + } + bool expected = true; + //Asert + Assert.True(result == expected); + } + } +} diff --git a/SecondLesson/readme.md b/SecondLesson/readme.md deleted file mode 100644 index c420268..0000000 --- a/SecondLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -Second lesson of Margelov Vitaly \ No newline at end of file diff --git a/SixthLesson/readme.md b/SixthLesson/readme.md deleted file mode 100644 index dd112f1..0000000 --- a/SixthLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -Sixth lesson of Margelov Vitaly \ No newline at end of file diff --git a/StudentsStatisticCore/Class1.cs b/StudentsStatisticCore/Class1.cs new file mode 100644 index 0000000..e7db970 --- /dev/null +++ b/StudentsStatisticCore/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace StudentsStatisticCore +{ + public class Class1 + { + } +} diff --git a/StudentsStatisticCore/Exceptions/StudentListIsEmptyException.cs b/StudentsStatisticCore/Exceptions/StudentListIsEmptyException.cs new file mode 100644 index 0000000..c880b95 --- /dev/null +++ b/StudentsStatisticCore/Exceptions/StudentListIsEmptyException.cs @@ -0,0 +1,8 @@ +using System; +namespace StudentsStatistics.Exceptions +{ + public class StudentsListIsEmptyException : Exception + { + + } +} diff --git a/StudentsStatisticCore/Exceptions/StudentsFileDoesNotExistsException.cs b/StudentsStatisticCore/Exceptions/StudentsFileDoesNotExistsException.cs new file mode 100644 index 0000000..e7707af --- /dev/null +++ b/StudentsStatisticCore/Exceptions/StudentsFileDoesNotExistsException.cs @@ -0,0 +1,7 @@ +using System; +namespace StudentsStatistics.Exceptions +{ + public class StudentsFileDoesNotExistsException : Exception + { + } +} diff --git a/StudentsStatisticCore/Student.cs b/StudentsStatisticCore/Student.cs new file mode 100644 index 0000000..dfd9fb5 --- /dev/null +++ b/StudentsStatisticCore/Student.cs @@ -0,0 +1,23 @@ +using System; + +namespace StudentsStatistics +{ + public class Student + { + public string Date { get; private set; } + public string Name { get; private set; } + public string Course { get; private set; } + public string Institute { get; private set; } + public string Dormitory { get; private set; } + + public Student(string date, string name, string course, string insitute, string dormitory) + { + Date = date ?? throw new ArgumentNullException(); + Name = name ?? throw new ArgumentNullException(); + Course = course ?? throw new ArgumentNullException(); + Institute = insitute ?? throw new ArgumentNullException(); + Dormitory = dormitory ?? throw new ArgumentNullException(); + } + } +} + diff --git a/StudentsStatisticCore/StudentStatisticCalc.cs b/StudentsStatisticCore/StudentStatisticCalc.cs new file mode 100644 index 0000000..9acfcd4 --- /dev/null +++ b/StudentsStatisticCore/StudentStatisticCalc.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using StudentsStatistics.Views; +using System; +using StudentsStatistics.Exceptions; + +namespace StudentsStatistics +{ + public class StudentStatisticCalc + { + public StatisticView CountInDorm(List studentsList) + { + if (studentsList == null) throw new ArgumentNullException(); + if (studentsList.Count == 0) throw new StudentsListIsEmptyException(); + var indorm = new int[] { }; + var result = new StatisticView(); + + foreach (var element in studentsList) + { + + result.Total++; + if (element.Course == "1 бакалавриат" && element.Dormitory == "Да") + { + result.FirstCourse++; + + } + if (element.Course == "2 бакалавриат" && element.Dormitory == "Да") + { + result.SecondCourse++; + + } + if (element.Course == "3 бакалавриат" && element.Dormitory == "Да") + { + result.ThirdCourse++; + } + } + + return result; + } + } +} diff --git a/StudentsStatisticCore/StudentsCreator.cs b/StudentsStatisticCore/StudentsCreator.cs new file mode 100644 index 0000000..ed45058 --- /dev/null +++ b/StudentsStatisticCore/StudentsCreator.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.IO; +using StudentsStatistics.Exceptions; + +namespace StudentsStatistics +{ + public static class StudentsCreator + { + private static Student FromLine(string line) + { + if (line == null) throw new ArgumentNullException(); + var data = new string[] { }; + data = line.Split(';'); + + return new Student(data[0], data[1], data[2], data[3], data[4]); + } + + public static List ReadStudents(string path) + { + var list = new List(); + try + { + foreach (var line in File.ReadLines(path)) + { + list.Add(FromLine(line)); + + } + } + catch(FileNotFoundException) + { + throw new StudentsFileDoesNotExistsException(); + } + + return list; + } + + + } +} diff --git a/StudentsStatisticCore/StudentsStatisticCore.csproj b/StudentsStatisticCore/StudentsStatisticCore.csproj new file mode 100644 index 0000000..075a554 --- /dev/null +++ b/StudentsStatisticCore/StudentsStatisticCore.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.0 + + + + + + + + + + diff --git a/StudentsStatisticCore/Views/StatisticView.cs b/StudentsStatisticCore/Views/StatisticView.cs new file mode 100644 index 0000000..ca344f5 --- /dev/null +++ b/StudentsStatisticCore/Views/StatisticView.cs @@ -0,0 +1,11 @@ +namespace StudentsStatistics.Views +{ + public class StatisticView + { + public int FirstCourse { get; set; } + public int SecondCourse { get; set; } + public int ThirdCourse { get; set; } + public int FourthCourse { get; set; } + public int Total { get; set; } + } +} diff --git a/StudentsStatistics.sln b/StudentsStatistics.sln new file mode 100644 index 0000000..268d4e2 --- /dev/null +++ b/StudentsStatistics.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsStatisticsTests", "StudentsStatisticsTests\StudentsStatisticsTests.csproj", "{598857A4-8927-453F-8697-A3C06D4389DB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsStatisticsConsoleCore", "StudentsStatisticsCore\StudentsStatisticsConsoleCore.csproj", "{9BC44367-5EA5-43E6-9322-4A58548F2FA9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentsStatisticCore", "StudentsStatisticCore\StudentsStatisticCore.csproj", "{E6C18921-C5BD-46C7-BA2E-E54392DDB0C0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {598857A4-8927-453F-8697-A3C06D4389DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {598857A4-8927-453F-8697-A3C06D4389DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {598857A4-8927-453F-8697-A3C06D4389DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {598857A4-8927-453F-8697-A3C06D4389DB}.Release|Any CPU.Build.0 = Release|Any CPU + {9BC44367-5EA5-43E6-9322-4A58548F2FA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BC44367-5EA5-43E6-9322-4A58548F2FA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BC44367-5EA5-43E6-9322-4A58548F2FA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BC44367-5EA5-43E6-9322-4A58548F2FA9}.Release|Any CPU.Build.0 = Release|Any CPU + {E6C18921-C5BD-46C7-BA2E-E54392DDB0C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6C18921-C5BD-46C7-BA2E-E54392DDB0C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6C18921-C5BD-46C7-BA2E-E54392DDB0C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6C18921-C5BD-46C7-BA2E-E54392DDB0C0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/StudentsStatistics/.DS_Store b/StudentsStatistics/.DS_Store new file mode 100644 index 0000000..a1aac1c Binary files /dev/null and b/StudentsStatistics/.DS_Store differ diff --git a/StudentsStatistics/:Users:danielaristizabaljaramillo:Desktop:SE:StudentsStatistics:StudentsStatisticsTests:Test.cs b/StudentsStatistics/:Users:danielaristizabaljaramillo:Desktop:SE:StudentsStatistics:StudentsStatisticsTests:Test.cs new file mode 100644 index 0000000..6400173 --- /dev/null +++ b/StudentsStatistics/:Users:danielaristizabaljaramillo:Desktop:SE:StudentsStatistics:StudentsStatisticsTests:Test.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; +using System; +namespace StudentsStatisticsTests +{ + [TestFixture()] + public class Test + { + [Test()] + public void TestCase() + { + + } + } +} diff --git a/StudentsStatistics/StudentsStatistics.csproj b/StudentsStatistics/StudentsStatistics.csproj new file mode 100644 index 0000000..8949b90 --- /dev/null +++ b/StudentsStatistics/StudentsStatistics.csproj @@ -0,0 +1,32 @@ + + + Debug + AnyCPU + {6F144441-95B7-41A4-93C7-6FF98031EB88} + Library + StudentsStatistics + StudentsStatistics + v4.7 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + true + bin\Release + prompt + 4 + false + + + + + + \ No newline at end of file diff --git a/StudentsStatisticsConsole/.DS_Store b/StudentsStatisticsConsole/.DS_Store new file mode 100644 index 0000000..2a266f7 Binary files /dev/null and b/StudentsStatisticsConsole/.DS_Store differ diff --git a/StudentsStatisticsConsole/Program.cs b/StudentsStatisticsConsole/Program.cs new file mode 100644 index 0000000..35309c0 --- /dev/null +++ b/StudentsStatisticsConsole/Program.cs @@ -0,0 +1,21 @@ +using System; +using StudentsStatistics; + +namespace StudentsStatisticsConsole +{ + class MainClass + { + public static void Main(string[] args) + { + // var path = Console.ReadLine(); + var path = "/Users/danielaristizabaljaramillo/Desktop/SE/StudentsStatistics/StudentsStatistics/bin/Debug/Тестирование.csv"; + var loadedStudents = StudentsCreator.ReadStudents(path); + + var studentsStat = new StudentStatisticCalc(); + + var result = studentsStat.CountInDorm(loadedStudents); + + Console.WriteLine($"1: {result.FirstCourse} 2: {result.SecondCourse} 3: {result.ThirdCourse} total: {result.Total}"); + } + } +} diff --git a/StudentsStatisticsConsole/Properties/AssemblyInfo.cs b/StudentsStatisticsConsole/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..de3089e --- /dev/null +++ b/StudentsStatisticsConsole/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("StudentsStatisticsConsole")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/StudentsStatisticsConsole/StudentsStatisticsConsole.csproj b/StudentsStatisticsConsole/StudentsStatisticsConsole.csproj new file mode 100644 index 0000000..b7297ba --- /dev/null +++ b/StudentsStatisticsConsole/StudentsStatisticsConsole.csproj @@ -0,0 +1,43 @@ + + + + Debug + AnyCPU + {1CCC4C27-5E6B-4DB6-8C6F-0ADB81D52B1F} + Exe + StudentsStatisticsConsole + StudentsStatisticsConsole + v4.7 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + prompt + 4 + true + + + + + + + + + + + {6F144441-95B7-41A4-93C7-6FF98031EB88} + StudentsStatistics + + + + \ No newline at end of file diff --git a/StudentsStatisticsCore/Program.cs b/StudentsStatisticsCore/Program.cs new file mode 100644 index 0000000..7fac1e0 --- /dev/null +++ b/StudentsStatisticsCore/Program.cs @@ -0,0 +1,21 @@ +using System; +using StudentsStatistics; + +namespace StudentsStatisticsConsole +{ + class MainClass + { + public static void Main(string[] args) + { + // var path = Console.ReadLine(); + var path = "/Users/danielaristizabaljaramillo/Desktop/SE/StudentsStatistics/StudentsStatistics/bin/Debug/Тестирование.csv"; + var loadedStudents = StudentsCreator.ReadStudents(path); + + var studentsStat = new StudentStatisticCalc(); + + var result = studentsStat.CountInDorm(loadedStudents); + + Console.WriteLine($"1: {result.FirstCourse} 2: {result.SecondCourse} 3: {result.ThirdCourse} total: {result.Total}"); + } + } +} diff --git a/StudentsStatisticsCore/StudentsStatisticsConsoleCore.csproj b/StudentsStatisticsCore/StudentsStatisticsConsoleCore.csproj new file mode 100644 index 0000000..1956998 --- /dev/null +++ b/StudentsStatisticsCore/StudentsStatisticsConsoleCore.csproj @@ -0,0 +1,11 @@ + + + + Exe + netcoreapp2.1 + + + + + + diff --git a/StudentsStatisticsTests/StudentsStatisticsTests.csproj b/StudentsStatisticsTests/StudentsStatisticsTests.csproj new file mode 100644 index 0000000..1fbe80b --- /dev/null +++ b/StudentsStatisticsTests/StudentsStatisticsTests.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp2.1 + + false + + + + + + + + + + + + + diff --git a/StudentsStatisticsTests/UnitTest1.cs b/StudentsStatisticsTests/UnitTest1.cs new file mode 100644 index 0000000..8fb371d --- /dev/null +++ b/StudentsStatisticsTests/UnitTest1.cs @@ -0,0 +1,36 @@ +using StudentsStatistics; +using Xunit; + +namespace StudentsStatisticsTests +{ + public class StudentStatisticsTest + { + [Fact] + public void ParsingisRight() + { + // Arrange + string expected = "test"; + // Act + var StudentTest = new Student("5-3]['", "test", "56]54]['", "56]34[5", "]4]435']6"); + //Assert + Assert.Equal(expected, StudentTest.Name); + + } + + [Fact] + public void FromLineTest(){ + //Arrange + Student expected = new Student("sfnrngjs","we2534","FWEGWE","WEG W GARG "," EGEWG"); + // Act + string AnyString = "sfnrngjs;we2534;FWEGWE;WEG W GARG;EGEWG"; + Student Resulttest = FromLine(AnyString); + + //Assert + Assert.Equal(expected, Resulttest); + + + + } + } + +} diff --git a/ThirdLesson/readme.md b/ThirdLesson/readme.md deleted file mode 100644 index 681ccfd..0000000 --- a/ThirdLesson/readme.md +++ /dev/null @@ -1 +0,0 @@ -Third lesson of Margelov Vitaly \ No newline at end of file