public SyndicationQueryFixture() { Context = TestSpmsContextFactory.Create(); Context.EpisodeEntry.Add(new EpisodeEntry() { EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Published).Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First(x => x.Name == StaticValues.Post).Id, Title = "First Post", Location = "Everywhere", Timeline = "MD0-09:00", PublishedAt = DateTime.UtcNow.AddDays(-1), EpisodeId = Context.Episode.Include(x => x.Series).Include(x => x.Status).First(x => x.Series.GameId == 1 && x.Status.Name == StaticValues.Published).Id, }); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <QueryMappings>(); }); Mapper = configurationProvider.CreateMapper(); }
public NotifyDiscordCmdFixture() { Context = TestSpmsContextFactory.Create(); Context.EpisodeEntry.Add(new EpisodeEntry() { EpisodeId = Context.Episode.First().Id, Title = "123 Post", IsPostedToDiscord = false, EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Published).Id, PublishedAt = DateTime.UtcNow.AddHours(-1), EpisodeEntryTypeId = Context.EpisodeEntryType.First(x => x.Name == StaticValues.Post).Id }); Context.SaveChanges(); }
public UpdateCharacterCommandFixture() { Context = TestSpmsContextFactory.Create(); var posting = new Posting() { Name = "Posting", GameId = 1, Default = true }; Context.Posting.Add(posting); var biographyType = new BiographyType() { Default = true, GameId = 1, Name = StaticValues.BioTypePlayer }; Context.BiographyTypes.Add(biographyType); Context.SaveChanges(); Context.Biography.Add(new Domain.Models.Biography() { Firstname = "Dan", Surname = "Taylor", TypeId = 1, Status = new BiographyStatus() { Name = "Status", Default = true, GameId = 1 }, State = new BiographyState() { Name = StaticValues.Published, Default = true, GameId = 1 }, Player = new Player() { DisplayName = "Dan" }, PostingId = posting.Id }); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <ApplicationMapper>(); }); Mapper = configurationProvider.CreateMapper(); MockUserService = new Mock <IUserService>(); MockUserService.Setup(x => x.GetId()).Returns(1); MockGameService = new Mock <IGameService>(); MockGameService.Setup(x => x.GetGameIdAsync()).ReturnsAsync(1); }
public SeoQueryFixture() { Context = TestSpmsContextFactory.Create(); var mock = new Mock <IHttpContextAccessor>(); var context = new DefaultHttpContext(); mock.Setup(_ => _.HttpContext).Returns(context); HttpContext = mock.Object; var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <ApplicationMapper>(); }); Mapper = configurationProvider.CreateMapper(); }
public AuthorPostCommandTestsFixture() { Context = TestSpmsContextFactory.Create(); var mockTenantAccessor = new Mock <ITenantAccessor <TenantDto> >(); mockTenantAccessor.Setup(x => x.Instance).Returns(new TenantDto() { Id = 1, GameName = "Test Game" }); TenantAccessor = mockTenantAccessor.Object; var mockUserService = new Mock <IUserService>(); mockUserService.Setup(x => x.GetId()).Returns(1); UserService = mockUserService.Object; }
public StoryPostQueryFixture() { Context = TestSpmsContextFactory.Create(); var game = Context.Game.First(); Context.Biography.Add(new Domain.Models.Biography() { Firstname = "Dan", Surname = "Taylor", Player = new Player() { AuthString = "123" }, State = new BiographyState() { Default = false, Name = "State", GameId = game.Id }, Posting = new Posting() { Name = "Starbase Gamma" } }); Context.SaveChanges(); var ipsum = new NLipsum.Core.LipsumGenerator(); var sentences = ipsum.GenerateSentences(3, new Sentence(5, 20)); var episodeEntry = new EpisodeEntry() { Title = sentences[0], Location = sentences[1], Timeline = sentences[2], Content = ipsum.GenerateLipsum(5), EpisodeId = Context.Episode.First().Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First(x => x.Name == StaticValues.Post).Id, EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Published).Id }; Context.EpisodeEntry.Add(episodeEntry); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <ApplicationMapper>(); }); Mapper = configurationProvider.CreateMapper(); }
public SchedulePostFixture() { Context = TestSpmsContextFactory.Create(); Context.EpisodeEntry.Add(new EpisodeEntry() { Title = "Post 1", Location = "Location", Timeline = "Timeline", Content = "A post!", Created = DateTime.UtcNow, CreatedBy = "Dan Taylor", LastModified = DateTime.UtcNow, LastModifiedBy = "Dan Taylor", EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Draft).Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First(x => x.Name == StaticValues.Post).Id }); Context.SaveChanges(); }
public GetCharacterQueryFixture() { var accessor = new Mock <ITenantAccessor <TenantDto> >(); accessor.Setup(x => x.Instance).Returns(new TenantDto() { Id = 1, SiteTitle = "Test Site", Author = "Dan Taylor & Evan Scown", IsSpiderable = true }); Tenant = accessor.Object; Context = TestSpmsContextFactory.Create(); var game = Context.Game.First(); Context.Biography.Add(new Domain.Models.Biography() { Firstname = "Dan", Surname = "Taylor", Player = new Player() { AuthString = "123" }, State = new BiographyState() { Default = false, Name = "State", GameId = game.Id }, Posting = new Posting() { Name = "Starbase Gamma" } }); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <ApplicationMapper>(); }); Mapper = configurationProvider.CreateMapper(); }
public WritingPortalQueryFixture() { Context = TestSpmsContextFactory.Create(); Context.Biography.Add(new Domain.Models.Biography() { Firstname = "Lionel", Surname = "Blair", Affiliation = "Starfleet", Assignment = "USS Voyager", Born = "Earth", StateId = Context.BiographyState.First().Id, StatusId = Context.BiographyStatus.First().Id, TypeId = Context.BiographyTypes.First().Id, PlayerId = 1 }); Context.SaveChanges(); Context.EpisodeEntry.Add(new EpisodeEntry() { EpisodeId = Context.Episode.First().Id, Title = "post", Content = "Blargh", EpisodeEntryPlayer = new Collection <EpisodeEntryPlayer>() { new EpisodeEntryPlayer() { PlayerId = 1 } }, EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Draft).Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First().Id }); Context.EpisodeEntry.Add(new EpisodeEntry() { EpisodeId = Context.Episode.First().Id, Title = "post", Content = "Blargh", EpisodeEntryPlayer = new Collection <EpisodeEntryPlayer>() { new EpisodeEntryPlayer() { PlayerId = 2 } }, EpisodeEntryStatusId = Context.EpisodeEntryStatus.First(x => x.Name == StaticValues.Draft).Id, EpisodeEntryTypeId = Context.EpisodeEntryType.First().Id }); Context.SaveChanges(); var configurationProvider = new MapperConfiguration(cfg => { cfg.AddProfile <QueryMappings>(); }); Mapper = configurationProvider.CreateMapper(); var mockTenantAccessor = new Mock <ITenantAccessor <TenantDto> >(); mockTenantAccessor.Setup(x => x.Instance).Returns(new TenantDto() { Id = 1, GameName = "Test Game" }); TenantAccessor = mockTenantAccessor.Object; }