Example #1
0
        public async void GetByIdAsyncShouldReturnCorrectWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetWidgetByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var    widgetRepository = new WidgetRepository(overwatchContext);
                Widget widgetToFind     = _widgets.First();
                await widgetRepository.AddAsync(widgetToFind);

                var result = await widgetRepository.GetByIdAsync(widgetToFind.Id);

                Assert.Equal(widgetToFind, result);
            }
        }
Example #2
0
        public async void PutAsyncShouldEditCorrectWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbPutWidgetAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var widgetRepository = new WidgetRepository(overwatchContext);
                await WidgetRepositoryFillerAsync(widgetRepository, _widgets);

                Widget widgetToEdit = _widgets.First();
                widgetToEdit.Color = "Green";
                var result = await widgetRepository.PutAsync(widgetToEdit.Id, widgetToEdit);

                Assert.Equal(1, result);
                var returnedWidget = widgetRepository.GetByIdAsync(widgetToEdit.Id).Result;
                Assert.Equal(returnedWidget, widgetToEdit);
            }
        }