Exemplo n.º 1
0
        public void AddOilVolumeItems()
        {
            var items = new[]
            {
                new OilVolume {
                    TankName = "tank 01", HInclination = 0.1m, VInclination = 0.2m, Height = 0.3m, Volume = 0.4m
                },
                new OilVolume {
                    TankName = "tank 02", HInclination = 5m, VInclination = 0.6m, Height = 0.7m, Volume = 0.8m
                }
            };

            var tankDb = new TankDb();

            tankDb.ClearOilVolumeItems();
            tankDb.Add(items);

            var actual = tankDb.GetAllOilVolumeItems();

            Assert.AreEqual(2, actual.Count());
            var item = actual.First(t => t.TankName.Equals("tank 01"));

            Assert.AreEqual(0.4m, item.Volume);
            Assert.AreEqual(0.3m, item.Height);
            Assert.AreEqual(0.2m, item.VInclination);
            Assert.AreEqual(0.1m, item.HInclination);
            item = actual.First(t => t.TankName.Equals("tank 02"));
            Assert.AreEqual(0.8m, item.Volume);
            Assert.AreEqual(0.7m, item.Height);
            Assert.AreEqual(0.6m, item.VInclination);
            Assert.AreEqual(5m, item.HInclination);

            // add more
            items = new[]
            {
                new OilVolume {
                    TankName = "tank 03", HInclination = 0.09m, VInclination = 10m, Height = 1.1m, Volume = 1200m
                }
            };
            tankDb.Add(items);
            actual = tankDb.GetAllOilVolumeItems();
            Assert.AreEqual(3, actual.Count());
            item = actual.First(t => t.TankName.Equals("tank 03"));
            Assert.AreEqual(1200m, item.Volume);
            Assert.AreEqual(1.1m, item.Height);
            Assert.AreEqual(10m, item.VInclination);
            Assert.AreEqual(0.09m, item.HInclination);
            actual = new TankDb().GetAllOilVolumeItems();
            Assert.AreEqual(3, actual.Count());
            item = actual.First(t => t.TankName.Equals("tank 03"));
            Assert.AreEqual(1200m, item.Volume);
            Assert.AreEqual(1.1m, item.Height);
            Assert.AreEqual(10m, item.VInclination);
            Assert.AreEqual(0.09m, item.HInclination);
        }
Exemplo n.º 2
0
        public void ClearOilVolumeItems()
        {
            var tankDb = new TankDb();

            tankDb.ClearOilVolumeItems();

            var actual = tankDb.GetAllOilVolumeItems();

            Assert.AreEqual(0, actual.Count());
            actual = new TankDb().GetAllOilVolumeItems();
            Assert.AreEqual(0, actual.Count());
        }