Example #1
0
        public static ISceneNode AddChild(IStoryService storyService, ICommonNodeFactory commonNodeFactory, int parent, object transaction)
        {
            storyService.OnBeginTransaction(transaction);
            var newNode = commonNodeFactory.StoryNode();

            if (storyService.GlobalGraph.Leaves.Contains(parent))
            {
                var nexts = storyService.GlobalGraph.Next[parent].ToArray();
                var prevs = storyService.GlobalGraph.Previous[parent].ToArray();
                foreach (var prev in prevs)
                {
                    storyService.RemoveEdge(prev, parent);
                }
                foreach (var next in nexts)
                {
                    storyService.RemoveEdge(parent, next);
                }
                storyService.GlobalGraph.NodeObjects[parent].ChildNodes.Add(newNode);
                foreach (var prev in prevs)
                {
                    storyService.AddEdge(prev, newNode.Id);
                }
                foreach (var next in nexts)
                {
                    storyService.AddEdge(newNode.Id, next);
                }
            }
            else
            {
                storyService.GlobalGraph.NodeObjects[parent].ChildNodes.Add(newNode);
            }
            storyService.OnEndTransaction(transaction);
            return(newNode);
        }
Example #2
0
 public GroupController(IUserService userService, IUserProfileUnitOfWork userProfileUnitOfWork, IStoryUnitOfWork storyUnitOfWork, IStoryService storyService)
 {
     this.userService           = userService;
     this.userProfileUnitOfWork = userProfileUnitOfWork;
     this.storyUnitOfWork       = storyUnitOfWork;
     this.storyService          = storyService;
 }
        public StoriesController(IStoryService storyService, IMappingService mappingService, IUserService userService, IUtilitiesService utils)
        {
            if (storyService == null)
            {
                throw new ArgumentNullException();
            }

            if (mappingService == null)
            {
                throw new ArgumentNullException();
            }

            if (userService == null)
            {
                throw new ArgumentNullException();
            }

            if (utils == null)
            {
                throw new ArgumentNullException();
            }

            this.storyService   = storyService;
            this.mappingService = mappingService;
            this.userService    = userService;
            this.utils          = utils;
        }
 public VrHeadPositionService(IStoryService storyService, IGlobalObjectService globalObjectService, IEventRoutingService eventRoutingService)
 {
     this.storyService        = storyService;
     this.globalObjectService = globalObjectService;
     localPlayerTransform     = ca.Transform.Identity;
     eventRoutingService.Subscribe <INewFrameEvent>(typeof(IVrHeadPositionService), nameof(OnNewFrame), OnNewFrame);
 }
Example #5
0
        public void SetUp()
        {
            var mock = new Mock <IStoryData>();

            IEnumerable <int> newStories = new List <int> {
                1, 2, 3
            };

            mock.Setup(x => x.GetNewStories())
            .Returns(Task.FromResult(newStories));

            var story = new Item
            {
                Id    = 1,
                Title = "Test",
                Type  = ItemType.Story,
                Url   = "https://www.google.com"
            };
            var story2 = new Item
            {
                Id    = 2,
                Title = "Test",
                Type  = ItemType.Story,
                Url   = "https://www.yahoo.com"
            };

            mock.Setup(x => x.GetStory(1))
            .Returns(Task.FromResult(story));
            mock.Setup(x => x.GetStory(2))
            .Returns(Task.FromResult(story2));
            mock.Setup(x => x.GetStory(It.IsNotIn(new int[] { 1, 2 })))
            .Returns(Task.FromResult <Item>(null));

            _storyService = new StoryService(mock.Object);
        }
        public StoryControllerTest()
        {
            Mock <IStoryService> moqStoryService = new Mock <IStoryService>();

            moqStoryService.Setup(s => s.GetStories()).Returns(new List <Story>());
            moqStoryService.Setup(s => s.GetStories(It.IsAny <int>())).Returns(new List <Story>());
            moqStoryService.Setup(s => s.GetStory(It.IsAny <int>())).Returns(new Story());
            moqStoryService.Setup(s => s.UpdateStory(It.IsAny <Story>()));
            moqStoryService.Setup(s => s.CreateStory(It.IsAny <Story>()));
            moqStoryService.Setup(s => s.SaveStory());

            Mock <IGroupService> moqGroupService = new Mock <IGroupService>();

            moqGroupService.Setup(s => s.GetGroups(It.IsAny <int>())).Returns(new List <Group>());
            moqGroupService.Setup(s => s.GetGroup(It.IsAny <int>())).Returns(new Group());

            Mock <IUserService> moqUserService = new Mock <IUserService>();

            moqUserService.Setup(u => u.GetUser(It.IsAny <int>())).Returns(new User());

            Mock <ILog> moqLog = new Mock <ILog>();


            _storyService = (IStoryService)moqStoryService.Object;
            _groupService = (IGroupService)moqGroupService.Object;
            _userService  = (IUserService)moqUserService.Object;
            _logger       = (ILog)moqLog.Object;

            controller = new StoryController(_storyService, _groupService, _userService, _logger);
            builder    = new TestControllerBuilder();
            builder.InitializeController(controller);
        }
Example #7
0
 public StoryController(IStoryService storyService, IGroupService groupService, IUserService userService, ILog logger)
 {
     this._storyService = storyService;
     this._groupService = groupService;
     this._userService  = userService;
     this._logger       = logger;
 }
Example #8
0
        public PropsGui(IViewService viewService, IUndoRedoService undoRedo, IAssetService assetService, IWorldTreeService worldTreeService,
                        IReadOnlyList <IStoryLayout> storyLayouts, IStoryService storyService, IEmbeddedResources embeddedResources, IWindowQueryService windowQueryService,
                        IMovieUrlLoader movieUrlLoader)
        {
            this.viewService = viewService;

            PropsPanel = new Panel
            {
                Content = new TableLayout(),
                Width   = 250,
                Height  = 300
            };

            groups = new IPropsGuiGroup[]
            {
                new PropsGuiGroupCommon(undoRedo),
                new PropsGuiGroupFluidSimulation(undoRedo),
                new PropsGuiGroupStoryComponent(undoRedo, storyLayouts, worldTreeService, storyService),
                new PropsGuiGroupMovieRectangle(undoRedo, assetService, windowQueryService, movieUrlLoader),
                new PropsGuiGroupHighlightOnMouse(undoRedo),
                new PropsGuiGroupComponents(undoRedo),
            };

            viewService.Update += OnViewServiceUpdate;
        }
 /// <summary>
 /// Story Manager constructor.
 /// </summary>
 /// <param name="storyService"></param>
 /// <param name="mapper"></param>
 /// <param name="cache"></param>
 public StoryManager(IStoryService storyService, IMapper mapper, IMemoryCache cache, ILogger <StoryManager> logger)
 {
     this.storyService = storyService ?? throw new ArgumentNullException(nameof(storyService));
     this.mapper       = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.cache        = cache ?? throw new ArgumentNullException(nameof(cache));
     this._logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public AddExplicitStoryGraphEdgeTool(int from, IRayHitIndex rayHitIndex, IToolService toolService, IStoryService storyService)
 {
     this.from         = from;
     this.rayHitIndex  = rayHitIndex;
     this.toolService  = toolService;
     this.storyService = storyService;
 }
 public ManageController(IRequestService requestService, IUserService userService, IStoryService storyService, IUtilitiesService utils)
 {
     this.requestService = requestService;
     this.userService    = userService;
     this.storyService   = storyService;
     this.utils          = utils;
 }
Example #12
0
 public UserProfileController(IUserService userService, IUserProfileUnitOfWork userProfileUOW, IStoryUnitOfWork storyUOW, IStoryService storyService)
 {
     this.userService    = userService;
     this.userProfileUOW = userProfileUOW;
     this.storyUOW       = storyUOW;
     this.storyService   = storyService;
 }
        public void Init()
        {
            var definition = new[] { "High", "Standard", "Any" };
            var dimension  = new[] { "Value2d", "Value3d", "Any" };
            var duration   = new[] { "Long__", "Medium", "Short__", "Any" };
            var caption    = new[] { "ClosedCaption", "None", "Any" };

            fakerRequest = new Faker <SearchRequest>()
                           .RuleFor(r => r.Title, f => f.Random.Word())
                           .RuleFor(r => r.CacheId, f => f.Random.Word())
                           .RuleFor(r => r.Definition, f => f.PickRandom(definition))
                           .RuleFor(r => r.Dimension, f => f.PickRandom(dimension))
                           .RuleFor(r => r.Duration, f => f.PickRandom(duration))
                           .RuleFor(r => r.VideoCaption, f => f.PickRandom(caption));

            kernel = new StandardKernel();
            kernel.Load <LogicModule>();
            var requestService = kernel.Get <ISearchRequestService>();

            for (int i = 0; i < 3; i++)
            {
                searchRequest.Add(requestService.Save(fakerRequest.Generate(1).First()));
            }

            fakerStory = new Faker <SearchStory>();
            fakerStory.RuleFor(s => s.SearchDate, f => f.Date.Past(1, null))
            .RuleFor(s => s.SearchRequest_Id, f => f.PickRandom(searchRequest).Id)
            .RuleFor(s => s.UserId, f => user1);

            stService    = kernel.Get <IStoryService>();
            stController = new StoryController(stService);
        }
Example #14
0
        public CommentController(IStoryRepository storyRepository, IStoryService storyService)
        {
            Check.Argument.IsNotNull(storyRepository, "storyRepository");
            Check.Argument.IsNotNull(storyService, "storyService");

            _storyRepository = storyRepository;
            _storyService    = storyService;
        }
Example #15
0
 public StoryViewModel(IStoryService storyService, IStoryRepository storyRepository, ICrashReportService crashReportService)
 {
     _storyService       = storyService;
     _storyRepository    = storyRepository;
     _crashReportService = crashReportService;
     StoryItems          = new ObservableCollection <ItemModel>();
     InitCommands();
 }
Example #16
0
 public StoryBranchIntoTool(int from, IRayHitIndex rayHitIndex, IToolService toolService, IStoryService storyService, ICommonNodeFactory commonNodeFactory)
 {
     this.from              = from;
     this.rayHitIndex       = rayHitIndex;
     this.toolService       = toolService;
     this.storyService      = storyService;
     this.commonNodeFactory = commonNodeFactory;
 }
Example #17
0
 public ViewService(IEventRoutingService eventRoutingService, IRenderLoopDispatcher renderLoopDispatcher, IStoryService storyService)
 {
     this.storyService = storyService;
     model             = AmFactory.Create <ViewServiceModel>();
     eventRoutingService.RegisterServiceDependency(typeof(IViewService), typeof(IWorldTreeService));
     eventRoutingService.Subscribe <IAppModeChangedEvent>(typeof(IViewService), nameof(OnAppModeChange), OnAppModeChange);
     renderLoopDispatcher.Update += OnUpdate;
 }
Example #18
0
 public GatherWoodButton(ApplicationState state, IStoryService storyService, IWood wood) : base(state)
 {
     _storyService = storyService;
     _wood         = wood;
     IsVisible     = true;
     IsClickable   = true;
     Title         = "gather wood";
     Cooldown      = 20_000;
 }
 public StoriesController(IStoryService storyService,
                          UserManager <User> userManager,
                          ILogger <StoriesController> logger)
     : base(userManager)
 {
     this.logger            = logger;
     this.storyService      = storyService;
     this.CurrentController = this.GetType().Name;
 }
Example #20
0
 public StoryController(MapperConfiguration mapperConfiguration,
                        ILogger logger,
                        IStoryService storyService,
                        IGroupService groupService)
     : base(mapperConfiguration, logger)
 {
     StoryService = storyService;
     GroupService = groupService;
 }
Example #21
0
 public HomeController(
     IChapterService chapterService,
     IIdentifierProvider identifierProvider,
     IStoryService storyService)
 {
     this.chapterService = chapterService;
     this.identifierProvider = identifierProvider;
     this.storyService = storyService;
 }
Example #22
0
 public StoryController(
     ICommentService commentService,
     IStoryService storyService, IProviderAgencyOwner agencyOwner,
     IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _commentService = commentService;
     _agencyOwner    = agencyOwner;
     _storyService   = storyService;
 }
Example #23
0
 public UsersController(
     IStoryService storyService,
     IChapterService chapterService,
     IIdentifierProvider identifierProvider)
 {
     this.storyService = storyService;
     this.chapterService = chapterService;
     this.identifierProvider = identifierProvider;
 }
Example #24
0
        public StoriesModule(IStoryService storyService, ILogger <StoriesModule> logger)
        {
            if (storyService == null)
            {
                throw new ArgumentNullException($"{nameof(storyService)} is null.");
            }
            if (logger == null)
            {
                throw new ArgumentNullException($"{nameof(logger)} is null.");
            }

            StoriesSourceEnum GetSourceOrDefault() =>
            Enum.TryParse <StoriesSourceEnum>(Request.Headers[headerSourceName].FirstOrDefault(), out StoriesSourceEnum res) ?
            res : defaultSource;

            Get("/list/{section:alpha}/first", async args =>
                Response.AsJson((await storyService.GetStoriesList(GetSourceOrDefault(), (String)args.section, 1, null, null)).FirstOrDefault()));

            Get("/list/{section:alpha}/{updatedDate:datetime(yyyy-MM-dd)}", async args =>
                Response.AsJson(await storyService.GetStoriesList(GetSourceOrDefault(), (String)args.section, null, (DateTime)args.updatedDate, null)));

            Get("/list/{section:alpha}", async args =>
                Response.AsJson(await storyService.GetStoriesList(GetSourceOrDefault(), (String)args.section, null, null, null)));

            Get("/article/(?<shortUrl>[a-zA-Z0-9]{7})", async args =>
                Response.AsJson((await storyService.GetStoriesList(GetSourceOrDefault(), homeSection, 1, null, (String)args.shortUrl)).FirstOrDefault()));

            Get("/group/{section:alpha}", async args => {
                var result = await storyService.GetGroupedStoriesByDate(GetSourceOrDefault(), (String)args.section);
                if (result.Count == 1)
                {
                    return(Response.AsJson(result.FirstOrDefault()));
                }

                return(Response.AsJson(result));
            });

            Get("/", args => Response.AsJson(new { message = "Hello world!" }));


            Before += (ctx) => {
                logger.LogInformation($"Request: {ctx.Request.Url}");

                return(null);
            };

            OnError += (ctx, ex) => {
                logger.LogError(ex.Message);

                return(HttpStatusCode.InternalServerError);
            };

            After += ctx =>
            {
                logger.LogDebug($"Response data: {ctx.Response}");
            };
        }
Example #25
0
 public StoryController(
     ICommentService commentService,
     IStoryService storyService, IOrganizationContractor contractor,
     IServiceProvider provider) : base(provider)
 {
     _commentService = commentService;
     _contractor     = contractor;
     _storyService   = storyService;
 }
 public StoriesController(
     IStoryService stories,
     IHtmlService html,
     UserManager <User> userManager)
 {
     this.stories     = stories;
     this.html        = html;
     this.userManager = userManager;
 }
Example #27
0
 public StoryButton(ApplicationState state, IStoryService storyService, IWood wood) : base(state)
 {
     _storyService = storyService;
     _wood         = wood;
     IsVisible     = true;
     IsClickable   = true;
     Title         = "search wood";
     Cooldown      = 5_000;
 }
Example #28
0
        public StoryController(
            IStoryService storyService,
            IOrganizationCustomer customer,
            IServiceProvider serviceProvider) : base(serviceProvider)

        {
            _customer     = customer;
            _storyService = storyService;
        }
Example #29
0
        public StoryCommentsViewModel(IStoryService storyService, IStoryCommentsRepository storyCommentsRepository, ICrashReportService crashReportService)
        {
            this.storyService            = storyService;
            this.storyCommentsRepository = storyCommentsRepository;

            this.crashReportService  = crashReportService;
            CommentItems             = new ObservableCollection <ItemCommentModel>();
            LoadStoryCommentsCommand = new Command <List <long> >(ExecuteLoadStoryCommentCommand);
        }
Example #30
0
 public House(IWood wood, IBuilder builder, ITownHall townHall, IWorkerService workerService, IStoryService storyService)
 {
     _wood          = wood;
     _builder       = builder;
     _townHall      = townHall;
     _workerService = workerService;
     _storyService  = storyService;
     _timer         = new Timer(InhabitantsCallback, null, 30_000, 30_000);
 }
Example #31
0
        public ResetButton(ApplicationState state, IStoryService storyService, ISaveStateService saveStateService) : base(state)
        {
            _storyService     = storyService;
            _saveStateService = saveStateService;

            Title       = "Reset";
            IsVisible   = true;
            IsClickable = true;
        }
 public TaskController(IProjectService projectService, IStoryService storyService, ISprintService sprintService, UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager, SignInManager <ApplicationUser> signInManager)
 {
     _sprintService  = sprintService;
     _projectService = projectService;
     _storyService   = storyService;
     _userManager    = userManager;
     _roleManager    = roleManager;
     _signInManager  = signInManager;
 }
Example #33
0
 public ChapterController(
     IStoryService storyService,
     IChapterService chapterService,
     IIdentifierProvider identifierProvider,
     IStatisticsService statisticsService)
 {
     this.storyService = storyService;
     this.chapterService = chapterService;
     this.identifierProvider = identifierProvider;
     this.statisticsService = statisticsService;
 }
 public StoryController(IStoryService storyService, IGroupService groupService)
 {
     _storyService = storyService;
     _groupService = groupService;
 }
 public GroupController(IGroupService groupService, IStoryService storyService)
 {
     _groupService = groupService;
     _storyService = storyService;
 }
Example #36
0
 public StoryAdminController(IStoryService storyService)
 {
     this.storyService = storyService;
 }
Example #37
0
 public ProjectController(IStoryService storyService)
 {
     this.storyService = storyService;
 }
 public StoryController(IStoryService storyService, IUserService userService)
     : base(userService)
 {
     _storyService = storyService;
 }
 public MainService(IStoryService storyService,
     ClassWithTwoConstructors anotherDependency)
 {
     _anotherDependency = anotherDependency;
 }
 public TaskController(IStoryService service = null)
     : base()
 {
     this.service = service;
 }