public override void CreateTestableObject() { _jsonSerializer = Substitute.For <IJsonSerializer>(); _persistenceContextFactory = Substitute.For <IPersistenceContextFactory>(); _persistenceContext = Substitute.For <IPersistenceContext <Assessment> >(); _responseParser = Substitute.For <IBackendlessResponseParser>(); _restServiceCaller = Substitute.For <IRestServiceCaller>(); _persistenceContextFactory.CreateFor <Assessment>().Returns(_persistenceContext); Ioc.RegisterSingleton(_jsonSerializer); Ioc.RegisterSingleton(_persistenceContextFactory); Ioc.RegisterSingleton(_responseParser); Ioc.RegisterSingleton(_restServiceCaller); Ioc.RegisterSingleton(_connection); _service = new RemovalPushService(); }
public override void CreateTestableObject() { _service = new PullService(); _connection = new Connection { AppId = "foo", SecretKey = "bar" }; _restServiceCaller = Substitute.For <IRestServiceCaller>(); _responseParser = Substitute.For <IBackendlessResponseParser>(); _persistenceContextFactory = Substitute.For <IPersistenceContextFactory>(); _persistenceContext = Substitute.For <IPersistenceContext <TestModel> >(); _persistenceContextFactory.CreateFor <TestModel>().Returns(_persistenceContext); _restServiceCaller.Get(Connection.GenerateTableUrl <TestModel>(), _connection.Headers).Returns(Task.FromResult(Json)); Ioc.RegisterSingleton(_connection); Ioc.RegisterSingleton(_restServiceCaller); Ioc.RegisterSingleton(_persistenceContextFactory); Ioc.RegisterSingleton(_responseParser); }