//private TileHolder.TileConfig New(TileHolder.TileConfig t) //{ // TileHolder.TileConfig r = new TileHolder.TileConfig(); // r.pos = new Vector2Int(t.pos.x, t.pos.y); // r.TileTemplate = t.TileTemplate; // r.Action = t.Action; // return r; //} private manipulation GetManipulation(ReadOrder order) { switch (order) { case ReadOrder.flipXY: return(FlipXY); case ReadOrder.reverseX: return(ReverseX); case ReadOrder.reverseY: return(ReverseY); case ReadOrder.rotate180: return(Rotate180); case ReadOrder.rotate90: return(Rotate90); case ReadOrder.rotate270: return(Rotate270); default: return(Error); } }
public async Task Update_Series_Books() { var series = await SeriesHelpers.CreateValidSeriesWithBooks(); var repository = new SeriesRepository(_fixture.Context); (await repository.ExistsAsync(series.Id)).Should().BeTrue(); var sut = await repository.LoadAsync(series.Id); var seriesId = sut.Id; sut.Should().NotBeNull(); sut.Books.Count.Should().Be(2); // Add one more book to series var book1 = await BookHelpers.CreateValidBook(); var book2 = await BookHelpers.CreateValidBook(); var newReadOrder = new List <ReadOrder> { ReadOrder.NewReadOrder(book1, null, 3), ReadOrder.NewReadOrder(book2, null, 4) }; await SeriesHelpers.UpdateSeriesReadOrder(sut.Id, newReadOrder); sut = await repository.LoadAsync(series.Id); sut.Books.Count.Should().Be(4); sut.Id.Should().Be(seriesId); }
public void Calculate_Specify_Column_with_Specify_Group() { //Arrange int theGroupYouWant = 4; string theColumnYouWant = "Revenue"; List <int> actual = new List <int>(); var expaected = new List <int>() { 50, 66, 60 }; //Act ReadOrder target = new ReadOrder(theColumnYouWant, ref actual, theGroupYouWant); //Assert CollectionAssert.AreEquivalent(expaected, actual); }
public async Task ChangeReadOrder(Series series, ICollection <ReadOrder> books) { var modSeries = await LoadAsync(series.Id).ConfigureAwait(false); var newBooks = books.Select(s => s.Book) .Except(modSeries.Books.Select(a => a.Book)).ToList(); if (newBooks.Any()) { foreach (var book in newBooks) { var nb = Context.Books.SingleOrDefault(b => b.Id == book.Id); var ro = new ReadOrder { Book = nb, Series = modSeries, Instalment = modSeries.Books.Count + 1 }; modSeries.Books.Add(ro); } } Context.Update(modSeries); await Context.SaveChangesAsync().ConfigureAwait(false); }
public static async Task <Series> CreateValidSeriesWithBooks() { var book1 = await BookHelpers.CreateValidBook("Book 1"); var book2 = await BookHelpers.CreateValidBook("Book 2"); var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); context.Attach(book1); context.Attach(book2); var repository = new SeriesRepository(context); var seriesService = new SeriesService(repository); var readOrder = new List <ReadOrder> { ReadOrder.NewReadOrder(book1, null, 1), ReadOrder.NewReadOrder(book2, null, 2) }; var command = new Commands.Create { Id = new SeriesId(SequentialGuid.NewSequentialGuid()), Name = "Series to be", PicturePath = @"\\filepath\file.jpg", Description = "Best books in the world!", Books = readOrder }; await seriesService.Handle(command); return(await repository.GetAsync(command.Id)); }
public OrderController(Startup.DeleteByIdResolver deleteAccesor, IOrderReadOnlyRepository readOrder) { delete = new DeleteOrder(deleteAccesor(DeletesID.Order), readOrder); read = new ReadOrder(readOrder); }