Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using OP2_LB2;
- namespace LinkedListTests
- {
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void ConstructorTest()
- {
- string a = "Pirmas";
- (double, double) b = (10, 25);
- (double, double) c = (15, 25);
- Rectangle rectangle = new Rectangle(a, b, c);
- Assert.IsNotNull(rectangle);
- Assert.AreEqual(a, rectangle.name);
- Assert.AreEqual(b, rectangle.topLeftCoord);
- Assert.AreEqual(c, rectangle.bottomRightCoord);
- }
- [TestMethod]
- public void AddTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("Antras", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Begin();
- Assert.AreEqual(rectangle1, RectangleList.Get());
- }
- [TestMethod()]
- public void SortTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- Rectangle rectangle3 = new Rectangle("C Trečias", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Add(rectangle3);
- RectangleList.Begin();
- RectangleList.Sort();
- Assert.AreEqual(rectangle2, RectangleList.Get());
- RectangleList.Next();
- Assert.AreEqual(rectangle1, RectangleList.Get());
- RectangleList.Next();
- Assert.AreEqual(rectangle3, RectangleList.Get());
- }
- [TestMethod()]
- public void CountTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- Rectangle rectangle3 = new Rectangle("C Trečias", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Add(rectangle3);
- Assert.AreEqual(RectangleList.Count(), 3);
- }
- [TestMethod()]
- public void BeginTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Begin();
- Assert.AreEqual(rectangle1, RectangleList.Get());
- }
- [TestMethod()]
- public void NextTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Begin();
- RectangleList.Next();
- Assert.AreEqual(rectangle2, RectangleList.Get());
- }
- [TestMethod()]
- public void ExistsTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Begin();
- Assert.AreEqual(RectangleList.Exists(), true);
- }
- [TestMethod()]
- public void GetTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Begin();
- RectangleList.Next();
- Assert.AreEqual(rectangle2, RectangleList.Get());
- }
- [TestMethod()]
- public void IsEmptyTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- RectangleList.Begin();
- Assert.AreEqual(RectangleList.IsEmpty(), true);
- }
- [TestMethod()]
- public void GetEnumeratorTest()
- {
- LinkedList<Rectangle> RectangleList = new LinkedList<Rectangle>();
- Rectangle rectangle1 = new Rectangle("B Pirmas", (10, 25), (15, 25));
- Rectangle rectangle2 = new Rectangle("A Antras", (10, 25), (15, 25));
- RectangleList.Add(rectangle1);
- RectangleList.Add(rectangle2);
- RectangleList.Begin();
- foreach (Rectangle rectangle in RectangleList)
- {
- Assert.AreEqual(rectangle, RectangleList.Get());
- RectangleList.Next();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment