Beispiel #1
0
        public async void CreateAlbumTest()
        {
            var genreId  = RandomId.NewId();
            var objGenre = new Genre(genreId, "genre test");

            objGenre.AddCashbackConfig(new Domain.Models.Cashback(null, genreId, System.DayOfWeek.Monday, 10));
            await DbContext.Genres.AddAsync(objGenre);

            await DbContext.SaveChangesAsync();

            var id  = RandomId.NewId();
            var cmd = new CreateAlbumCommand()
            {
                Id        = id,
                Name      = "Test Genre 1",
                GenreId   = genreId,
                SpotifyId = null
            };

            var result = await CommandsHandler.Handle(cmd);

            var obj = await DbContext.Albums.Where(w => w.Id == id).FirstOrDefaultAsync();

            Assert.NotNull(result);
            Assert.NotNull(obj);
            Assert.Equal(ErrorCode.None, result.ErrorCode);
            Assert.Equal(id, obj.Id);
            Assert.True(result.Rows > 0);
        }
Beispiel #2
0
        public void AddCashbackConfigTest()
        {
            var obj = new Genre(null, "test genre 2");

            obj.AddCashbackConfig(new Domain.Models.Cashback(null, obj.Id, DayOfWeek.Monday, 15));

            Assert.NotNull(obj);
            Assert.Equal(8, obj.Id.Length);
            Assert.NotNull(obj.Name);
            Assert.NotNull(obj.Cashbacks);
            Assert.Single(obj.Cashbacks);
        }
Beispiel #3
0
        public SaleTests()
        {
            genres = new List <Genre>();

            var pop = new Genre(null, "Pop");

            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Sunday, 25));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Monday, 7));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Tuesday, 6));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Wednesday, 2));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Thursday, 10));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Friday, 15));
            pop.AddCashbackConfig(new Domain.Models.Cashback(null, pop.Id, DayOfWeek.Saturday, 20));

            var mpb = new Genre(null, "MPB");

            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Sunday, 30));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Monday, 5));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Tuesday, 10));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Wednesday, 15));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Thursday, 20));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Friday, 25));
            mpb.AddCashbackConfig(new Domain.Models.Cashback(null, mpb.Id, DayOfWeek.Saturday, 30));

            var classic = new Genre(null, "Classic");

            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Sunday, 35));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Monday, 3));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Tuesday, 5));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Wednesday, 8));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Thursday, 13));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Friday, 18));
            classic.AddCashbackConfig(new Domain.Models.Cashback(null, classic.Id, DayOfWeek.Saturday, 25));

            var rock = new Genre(null, "Rock");

            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Sunday, 40));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Monday, 10));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Tuesday, 15));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Wednesday, 15));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Thursday, 15));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Friday, 20));
            rock.AddCashbackConfig(new Domain.Models.Cashback(null, rock.Id, DayOfWeek.Saturday, 40));

            genres.Add(pop);
            genres.Add(mpb);
            genres.Add(classic);
            genres.Add(rock);
        }