public void TestTask5Nothing() { IReadOnlyList <CUserDTO> users = new List <CUserDTO> { new CUserDTO { Name = "A" }, new CUserDTO { Name = "Jo" }, new CUserDTO { Name = "Ron" }, new CUserDTO { Name = "Mark" }, new CUserDTO { Name = "Anton" } }; IList <CUserDTO> actual = STaskLINQ.Task5Filter(users); IReadOnlyList <CUserDTO> expected = new List <CUserDTO>(); Assert.NotNull(actual); Assert.Empty(actual); Assert.Equal(expected, actual); }
public void TestTask5Simple() { IReadOnlyList <CUserDTO> users = new List <CUserDTO> { new CUserDTO { Name = "Mark" }, new CUserDTO { Name = "August" }, new CUserDTO { Name = "Arthur" }, new CUserDTO { Name = "Anton" }, new CUserDTO { Name = "Vasily" } }; IList <CUserDTO> actual = STaskLINQ.Task5Filter(users); IReadOnlyList <CUserDTO> expected = users; Assert.NotNull(actual); Assert.Equal(expected.Count, actual.Count); Assert.NotEmpty(actual); Assert.All(actual, item => Assert.NotNull(item)); Assert.Equal(expected, actual); }
public void TestTask4ConcatAll() { IReadOnlyCollection <CUserDTO> users = new List <CUserDTO> { new CUserDTO { Name = "Mark" }, new CUserDTO { Name = "August" }, new CUserDTO { Name = "Arthur" }, new CUserDTO { Name = "Vasily" }, new CUserDTO { Name = "Anton" } }; string actual = STaskLINQ.Task4Concat(users, '.', 0); string expected = "Mark.August.Arthur.Vasily.Anton"; Assert.NotNull(actual); Assert.True(expected.IsEqualWithInvariantCulture(actual)); }
public void TestTask6ThreeGroups() { string sentence = "жить или не жить - вот чем мы..."; IList <List <string> > actual = STaskLINQ.Task6GroupAndSort(sentence); IReadOnlyList <List <string> > expected = new List <List <string> > { new List <string> { "или", "вот", "чем" }, new List <string> { "жить", "жить" }, new List <string> { "не", "мы" } }; Assert.NotNull(actual); Assert.Equal(expected.Count, actual.Count); Assert.NotEmpty(actual); Assert.All(actual, item => Assert.NotNull(item)); Assert.Equal(expected, actual); }
public void TestTask5Complex() { IReadOnlyList <CUserDTO> users = new List <CUserDTO> { new CUserDTO { Name = "Mark" }, new CUserDTO { Name = "August" }, new CUserDTO { Name = "Arthur" }, new CUserDTO { Name = "Vasily" }, new CUserDTO { Name = "Anton" }, new CUserDTO { Name = "Alexander" }, new CUserDTO { Name = "Lachesis" }, new CUserDTO { Name = "Jessica" }, new CUserDTO { Name = "Isabella" }, new CUserDTO { Name = "Amelia" } }; IList <CUserDTO> actual = STaskLINQ.Task5Filter(users); IReadOnlyList <CUserDTO> expected = new List <CUserDTO> { users[0], // Mark users[1], // August users[2], // Arthur users[3], // Vasily users[5], // Alexander users[6] // Lachesis }; Assert.NotNull(actual); Assert.NotEmpty(actual); Assert.All(actual, item => Assert.NotNull(item)); Assert.Equal(expected, actual); }
public void TestTask6OneGroup() { string sentence = "Ты, мы, он - ок"; IList <List <string> > actual = STaskLINQ.Task6GroupAndSort(sentence); IReadOnlyList <List <string> > expected = new List <List <string> > { new List <string> { "Ты", "мы", "он", "ок" } }; Assert.NotNull(actual); Assert.Equal(expected.Count, actual.Count); Assert.NotEmpty(actual); Assert.All(actual, item => Assert.NotNull(item)); Assert.Equal(expected, actual); }
public void TestTask6Simple() { string sentence = "Это что же получается: ходишь, ходишь в школу, а потом бац - " + "вторая смена"; IList <List <string> > actual = STaskLINQ.Task6GroupAndSort(sentence); IReadOnlyList <List <string> > expected = new List <List <string> > { new List <string> { "Это", "что", "бац" }, new List <string> { "ходишь", "ходишь", "вторая" }, new List <string> { "школу", "потом", "смена" }, new List <string> { "в", "а" }, new List <string> { "же" }, new List <string> { "получается" }, }; Assert.NotNull(actual); Assert.Equal(expected.Count, actual.Count); Assert.NotEmpty(actual); Assert.All(actual, item => Assert.NotNull(item)); Assert.Equal(expected, actual); }