public static Promise <DeployedScene[]> FetchScenes(ICatalyst catalyst, string[] parcels, float cacheMaxAgeSeconds = DEFAULT_SCENES_CACHE_TIME)
    {
        Promise <DeployedScene[]> promise = new Promise <DeployedScene[]>();

        catalyst.GetDeployedScenes(parcels, cacheMaxAgeSeconds)
        .Then(result =>
        {
            promise.Resolve(result.Select(deployment => new DeployedScene(deployment, catalyst.contentUrl)).ToArray());
        })
        .Catch(err => promise.Reject(err));
        return(promise);
    }
예제 #2
0
        public void SetUp()
        {
            controller = new BuilderProjectsPanelController();

            sectionsController   = Substitute.For <ISectionsController>();
            scenesViewController = Substitute.For <IScenesViewController>();
            landsController      = Substitute.For <ILandController>();

            ITheGraph theGraph = Substitute.For <ITheGraph>();

            theGraph.Query(Arg.Any <string>(), Arg.Any <string>()).Returns(new Promise <string>());
            theGraph.Query(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <QueryVariablesBase>()).Returns(new Promise <string>());
            theGraph.QueryLands(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <float>()).Returns(new Promise <List <Land> >());

            ICatalyst catalyst = Substitute.For <ICatalyst>();

            catalyst.contentUrl.Returns(string.Empty);
            catalyst.Get(Arg.Any <string>()).Returns(new Promise <string>());
            catalyst.GetEntities(Arg.Any <string>(), Arg.Any <string[]>()).Returns(new Promise <string>());
            catalyst.GetDeployedScenes(Arg.Any <string[]>()).Returns(new Promise <CatalystSceneEntityPayload[]>());

            controller.Initialize(sectionsController, scenesViewController,
                                  landsController, theGraph, catalyst);
        }