public void Test_Getters_And_Setters() { List<Orderline> orderlines = new List<Orderline>(); Orderline OL1= new Orderline() {OrderId = 2, MovieId = 6, Amount = 6, Price = 30}; Orderline Ol2= new Orderline() {OrderId = 2, MovieId = 17, Amount = 8, Price = 30}; orderlines.Add(Ol2); orderlines.Add(OL1); Customer cust = new Customer() { Id = 1, FirstName = "Someone", MiddleName = "Else", LastName = "Name", Email = "*****@*****.**", StreetName = "Bla Vej", StreetNumber = 1, Password = "******" }; Status stat = new Status() { Id = 1, Name = "Shipped" }; Order Ord = new Order() {Id=1,Orderlines = orderlines, Customer = cust, OrderDate = DateTime.Now.Date, Status = stat}; Ord.Id = 1; Ord.Orderlines = orderlines; Ord.Customer = cust; Ord.OrderDate=DateTime.Now.Date; Ord.Status = stat; Assert.AreEqual(Ord.Id,1); Assert.AreEqual(Ord.Orderlines,orderlines); Assert.AreEqual(Ord.Customer,cust); Assert.AreEqual(Ord.OrderDate, DateTime.Now.Date); Assert.AreEqual(Ord.Status,stat); }
public void Test_Constructor() { List<Orderline> orderlines = new List<Orderline>(); Orderline OL1 = new Orderline() { OrderId = 2, MovieId = 6, Amount = 6, Price = 30 }; Orderline Ol2 = new Orderline() { OrderId = 2, MovieId = 17, Amount = 8, Price = 30 }; orderlines.Add(Ol2); orderlines.Add(OL1); Customer cust = new Customer() { Id = 1, FirstName = "Someone", MiddleName = "Else", LastName = "Name", Email = "*****@*****.**", StreetName = "Bla Vej", StreetNumber = 1, Password = "******" }; Order Ord = new Order(orderlines, cust); Assert.NotNull(Ord); Assert.NotNull(orderlines); Assert.NotNull(cust); }
public void Test_Add_ShoppingCart() { ShoppingCart cart = new ShoppingCart(); Orderline OL = new Orderline(); Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" }; Customer cust = new Customer() { Id = 1, FirstName = "Someone", MiddleName = "Else", LastName = "Name", Email = "*****@*****.**", StreetName = "Bla Vej", StreetNumber = 1, Password = "******" }; OL.Movie = mov; OL.Amount = 3; cust.Id = 1; cart.CustomerId = 1; cart.Orderline.Add(OL); Assert.AreEqual(cart.CustomerId,1); Assert.AreEqual(cust.Id, 1); Assert.AreEqual(cart.Orderline.First(), OL, "The movies should be equal"); }
public void Amount_Out_Of_Range() { Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" }; Orderline OL = new Orderline(); OL.Movie = mov; Assert.Throws<IndexOutOfRangeException>(() => OL.Amount = 11); }
public void TestGetters() { Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" }; Orderline OL = new Orderline(); OL.MovieId = 1; OL.OrderId = 2; OL.Price = 150; OL.Id = 2; OL.Movie = mov; OL.Amount = 3; Assert.AreEqual(OL.Id, 2); Assert.AreEqual(OL.MovieId, 1); Assert.AreEqual(OL.OrderId, 2); Assert.AreEqual(OL.Price, 150); Assert.AreEqual(OL.Movie, mov, "The movies should be equal"); Assert.AreEqual(OL.Amount, 3, "The amount should be equal"); }