Beispiel #1
0
        public void WidgetService_GetWidget_ReturnsAWidgetWhenIdExists()
        {
            var textWidget = new BasicMappedWidget();

            Session.Transact(session => session.SaveOrUpdate(textWidget));

            var loadedWidget = _widgetService.GetWidget <BasicMappedWidget>(textWidget.Id);

            loadedWidget.Should().BeSameAs(textWidget);
        }
Beispiel #2
0
        public void ConnectToExpensiveResourceAndGetAWidget()
        {
            var service = new WidgetService(new WidgetData());

            var widget = service.GetWidget(1); //gotta make sure my data has this widget!

            Assert.IsNotNull(widget);
        }
Beispiel #3
0
        public void GetWidgetExpected()
        {
            var mockData = GetStubData();
            var service  = new WidgetService(mockData.Object);

            var widget = service.GetWidget(1);

            Assert.IsNotNull(widget);
        }
Beispiel #4
0
        public void WidgetNullIfNotFound()
        {
            //arrange
            var mockData = GetStubData();

            var service = new WidgetService(mockData.Object);

            //act
            var widget = service.GetWidget(5);

            //assert
            Assert.IsNull(widget);
        }