Example #1
0
        private async Task Verify()
        {
            //verify well was uploaded correctly
            var wells = await _wellProvider.GetAll();

            var well  = wells.FirstOrDefault(x => x.Id == "2508321270");
            var owell = ModelConstants.GetWell();

            var swell  = JsonConvert.SerializeObject(well);
            var sowell = JsonConvert.SerializeObject(owell);

            Assert.Equal(swell, sowell);

            //verify tank was uploaded correctly
            var tanks = await _tankProvider.GetByWellId(well.Id);

            var tank  = tanks.FirstOrDefault(x => x.Id == 1065);
            var otank = ModelConstants.GetTank();

            var stank  = JsonConvert.SerializeObject(tank);
            var sotank = JsonConvert.SerializeObject(otank);

            Assert.Equal(stank, sotank);
        }
Example #2
0
        public async Task should_save_every_update_of_a_tank()
        {
            //for comparing tanks original state
            var cotank1 = ModelConstants.GetTank();

            //for comparing tanks new state
            var cntank1 = new TankModel
            {
                Id           = 1065,
                Name         = "Sorenson",
                Number       = 5,
                Size         = 450.56m,
                BbblsPerInch = 2.575867769m,
                SEC          = 7,
                TWP          = "022M",
                RNG          = "059F",
                County       = "GREENLAND",
                WellId       = "2508321270"
            };


            //load data with one well
            var filename = "./Resources/WellDataTest.csv";
            await _wellDataImporter.Upload(filename);

            //verify there is one well
            var wells = await _wellProvider.GetAll();

            var well = wells.FirstOrDefault();

            Assert.NotNull(well);

            //get tanks for the one well
            var tanks = await _tankProvider.GetByWellId(well.Id);

            //verify expected first state
            var tank1 = tanks.FirstOrDefault(x => x.Id == 1065);

            var stank1   = JsonConvert.SerializeObject(tank1);
            var scotank1 = JsonConvert.SerializeObject(cotank1);

            Assert.Equal(stank1, scotank1);

            //change all of tank one
            tank1.Name         = "Sorenson";
            tank1.Number       = 5;
            tank1.Size         = 450.56m;
            tank1.BbblsPerInch = 2.575867769m;
            tank1.SEC          = 7;
            tank1.TWP          = "022M";
            tank1.RNG          = "059F";
            tank1.County       = "GREENLAND";


            //save dirty tank
            var dirty = tanks.Where(x => x.IsDirty()).ToArray();
            await _tankProvider.Save(dirty);

            //get tanks again by well
            var ntanks = _tankProvider.GetByWellId(well.Id);

            //verify expected first change
            var ntank1 = tanks.FirstOrDefault(x => x.Id == 1065);

            var sntank1   = JsonConvert.SerializeObject(ntank1);
            var sncotank1 = JsonConvert.SerializeObject(cntank1);

            Assert.Equal(sntank1, sncotank1);
        }