Esempio n. 1
0
        public async Task UpdateAsync()
        {
            var panel = new Panel
            {
                Brand     = "NonEmpty",
                Latitude  = 12,
                Longitude = 123,
                Serial    = "NonEmpty",
            };

            int insertResponse = await _repository.InsertAsync(panel);

            Assert.NotEqual(default(int), panel.Id);

            var getPanelResponse = await _repository.GetAsync(panel.Id);

            getPanelResponse.Brand     = "newBrand";
            getPanelResponse.Latitude  = 123;
            getPanelResponse.Longitude = 12;
            getPanelResponse.Serial    = "newSerial";

            await _repository.UpdateAsync(getPanelResponse);

            var getUpdatedPanelResponse = await _repository.GetAsync(getPanelResponse.Id);

            Assert.True(getUpdatedPanelResponse.Latitude == 123);
            Assert.True(getUpdatedPanelResponse.Longitude == 12);
            Assert.True(getUpdatedPanelResponse.Brand == "newBrand");
            Assert.True(getUpdatedPanelResponse.Serial == "newSerial");
        }
        public void UpdateAsync()
        {
            var panel = CreateRandom();

            int res = _repository.InsertAsync(panel).Result;

            var result = _repository.GetAsync(panel.Id).Result;


            result.Brand     = "ax2";
            result.Latitude  = 12;
            result.Longitude = 21;
            result.Serial    = "x2";

            _repository.UpdateAsync(result).Wait();

            var result2 = _repository.GetAsync(result.Id).Result;

            FullCompare(result, result2);
        }