Esempio n. 1
0
        public void AddAndGetService()
        {
            IBusinessObjectService expectedService = _mockRepository.Stub <IBusinessObjectService>();

            Assert.That(_provider.GetService(expectedService.GetType()), Is.Null);

            ((BusinessObjectProvider)_provider).AddService(expectedService.GetType(), expectedService);

            Assert.That(_provider.GetService(expectedService.GetType()), Is.SameAs(expectedService));
        }
        /// <summary> Registers a new <see cref="IBusinessObjectService"/> with this <see cref="BusinessObjectProvider"/>. </summary>
        /// <param name="serviceType"> The <see cref="Type"/> of the <paramref name="service"/> to be registered. Must not be <see langword="null" />.</param>
        /// <param name="service"> The <see cref="IBusinessObjectService"/> to register. Must not be <see langword="null" />.</param>
        public void AddService(Type serviceType, IBusinessObjectService service)
        {
            ArgumentUtility.CheckNotNullAndTypeIsAssignableFrom("serviceType", serviceType, typeof(IBusinessObjectService));
            ArgumentUtility.CheckNotNull("service", service);

            IDataStore <Type, IBusinessObjectService> serviceStore = ServiceStore;

            Assertion.IsNotNull(serviceStore, "The ServiceStore evaluated and returned null. It should return a non-null object instead.");

            serviceStore[serviceType] = service;
        }
Esempio n. 3
0
        public void GetService_FromExplictValue()
        {
            MockRepository mockRepository = new MockRepository();
            IBusinessObjectServiceFactory         serviceFactoryMock = mockRepository.StrictMock <IBusinessObjectServiceFactory>();
            IBusinessObjectStringFormatterService serviceStub        = MockRepository.GenerateStub <IBusinessObjectStringFormatterService>();
            BusinessObjectProvider provider = new StubBusinessObjectProvider(serviceFactoryMock);

            provider.AddService(typeof(IBusinessObjectStringFormatterService), serviceStub);

            mockRepository.ReplayAll();

            IBusinessObjectService actual  = provider.GetService(typeof(IBusinessObjectStringFormatterService));
            IBusinessObjectService actual2 = provider.GetService(typeof(IBusinessObjectStringFormatterService));

            mockRepository.VerifyAll();

            Assert.That(actual, Is.SameAs(serviceStub));
            Assert.That(actual, Is.SameAs(actual2));
        }
 public void Init()
 {
     service = new BusinessObjectService();
 }
 public void Init()
 {
     service = new BusinessObjectService();
 }
Esempio n. 6
0
 public void AddService(Type serviceType, IBusinessObjectService service)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 public StoreController(IBusinessObjectService service)
 {
     BusinessObject = service.GetStoreBusinessObject();
 }
Esempio n. 8
0
 public UserTypeController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
 public AdministrationController(IBusinessObjectService service)
 {
     BusinessObject = service.GetSalesBusinessObject();
 }
Esempio n. 10
0
 public CategoryController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
Esempio n. 11
0
 public SaleControlController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
Esempio n. 12
0
 public PersonController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
Esempio n. 13
0
 public FoodMenuController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
Esempio n. 14
0
 public DesignerController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }
Esempio n. 15
0
 public OrderController(IBusinessObjectService service)
 {
     BusinessObject = service.GetBusinessObject();
 }