Beispiel #1
0
 public void GetSurfaceSquareTest()
 {
     BoxService target = new BoxService();
     Box box = new Box(1, 2, 3);
     double expected = 1 * 2 * 2 + 1 * 3 * 2 + 2 * 3 * 2;
     double actual = target.GetSurfaceSquare(box);
     Assert.AreEqual(expected, actual);
 }
Beispiel #2
0
 public void GetVolumeTest()
 {
     BoxService target = new BoxService();
     Box box = new Box(1, 2, 3);
     double expected = 6F;
     double actual;
     actual = target.GetVolume(box);
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
        public List<Box> Sort(Store store)
        {
            if (store == null)
            {
                throw new ArgumentException("Ссылка не указывает на объект");
            }

            List<Box> boxes = store.Boxes;

            boxes.Sort((o1, o2) =>
            {
                BoxService service = new BoxService();
                double firstVolume = service.GetVolume(o1);
                double secondVolume = service.GetVolume(o2);

                return firstVolume.CompareTo(secondVolume);
            });

            return boxes;
        }
Beispiel #4
0
        public List <Box> Sort(Store store)
        {
            if (store == null)
            {
                throw new ArgumentException("Ссылка не указывает на объект");
            }

            List <Box> boxes = store.Boxes;

            boxes.Sort((o1, o2) =>
            {
                BoxService service  = new BoxService();
                double firstVolume  = service.GetVolume(o1);
                double secondVolume = service.GetVolume(o2);

                return(firstVolume.CompareTo(secondVolume));
            });

            return(boxes);
        }
Beispiel #5
0
 public void GetVolumeTestExeption()
 {
     BoxService target = new BoxService();
     Box box = null;
     double actual = target.GetVolume(box);
 }
Beispiel #6
0
 public void GetSurfaceSquareTestExeption()
 {
     BoxService target = new BoxService();
     Box box = null;
     double actual = target.GetSurfaceSquare(box);
 }