public void TestGetRecordsCount() { //Arrange var fileCabinet = new FileCabinetService(); const int expected = 2; //Act fileCabinet.Create("firstName", "lastName", "dateOfBirth"); fileCabinet.Create("first", "last", "date"); var result = fileCabinet.GetRecordsCount(); //Assert Assert.AreEqual(expected, result); }
/// <summary> /// Creates a new record and add to the in memory list of records /// </summary> private static void Create() { Console.Write("First name:"); var firstName = Console.ReadLine(); if (!CharsIsLetters(firstName)) { return; } Console.Write("Last name:"); var lastName = Console.ReadLine(); if (!CharsIsLetters(lastName)) { return; } Console.WriteLine("Date of birth:"); var dateOfBirth = Console.ReadLine(); CabinetService.Create(firstName, lastName, dateOfBirth); Console.WriteLine($"Record #{CabinetService.GetRecords().Count()} is created."); }
public void TestRemoveAt() { //Arrange var fileCabinet = new FileCabinetService(); var expected = new List <Record> { new Record { FirstName = "firstName", LastName = "lastName", DateOfBirth = "dateOfBirth" } }; //Act fileCabinet.Create("firstName", "lastName", "dateOfBirth"); fileCabinet.Create("first", "last", "date"); fileCabinet.RemoveAt(1); var result = fileCabinet.GetRecords().ToList(); //Assert CollectionAssert.AreEqual(expected, result); }
public void TestClear() { //Arrange var fileCabinet = new FileCabinetService(); var expected = new List <Record>(); //Act fileCabinet.Create("firstName", "lastName", "dateOfBirth"); fileCabinet.Clear(); var result = fileCabinet.GetRecords().ToList(); //Assert CollectionAssert.AreEqual(expected, result); }
public void TestCreate(string firstName, string lastName, string dateOfBirth) { //Arrange var fileCabinet = new FileCabinetService(); var expected = new List <Record> { new Record { FirstName = firstName, LastName = lastName, DateOfBirth = dateOfBirth } }; //Act fileCabinet.Create(firstName, lastName, dateOfBirth); var result = fileCabinet.GetRecords().ToList(); //Assert CollectionAssert.AreEqual(expected, result); }