Exemplo n.º 1
0
        public void CheckIfThereIsAorderInTheReports()
        {
            //Arange
            var reportService = new ReportsService(db);

            var firstOrder = new Order {
                Id = "1", Name = "Test1"
            };
            var secondOrder = new Order {
                Id = "2", Name = "Test2"
            };
            var thirdOrder = new Order {
                Id = "3", Name = "Test3"
            };
            var firstReport = new Report {
                Id = "1", OrderId = firstOrder.Id, Order = firstOrder
            };
            var secondReport = new Report {
                Id = "2", OrderId = secondOrder.Id, Order = secondOrder
            };
            var thirdReport = new Report {
                Id = "3", OrderId = thirdOrder.Id, Order = thirdOrder
            };

            db.Order.AddRange(firstOrder, secondOrder, thirdOrder);
            db.Report.AddRange(firstReport, secondReport, thirdReport);
            db.SaveChanges();

            //Act
            var positiveResult = reportService.CheckForOrderId("1");
            var negativeResult = reportService.CheckForOrderId("11");

            //Assert
            var expectedPositive = true;
            var expectedNegative = false;

            Assert.Equal(expectedPositive, positiveResult);
            Assert.Equal(expectedNegative, negativeResult);
        }