Beispiel #1
0
        private void Seed()
        {
            using (var context = new DatabaseContext(databaseContextOptions, httpAccessorMock.Object)) {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                argumentQuery = new ReportArgumentQuery()
                {
                    ArgQuery = "query", ReportArgumentQueryId = 1
                };
                reportArgument = new ReportArgument {
                    Name = "date", ReportArgumentId = 1, ArgType = "DateTime", ReportId = 1
                };
                group = new ReportGroup()
                {
                    Name = "groupName", ReportGroupId = 1
                };
                report = new Report()
                {
                    Description     = "someDescription",
                    Name            = "someName",
                    ReportId        = reportArgument.ReportId,
                    ReportArguments = new List <ReportArgument>()
                    {
                        reportArgument
                    },
                    ReportGroupId = group.ReportGroupId
                };

                context.AddRange(argumentQuery, reportArgument, group, report);
                context.SaveChanges();
            }
        }
Beispiel #2
0
        public void GetReportArgumentQueryShouldReturnObject()
        {
            //arrange
            var reportArgumentQuery = new ReportArgumentQuery()
            {
                ArgQuery = "someQuery",
                ReportArgumentQueryId = 1
            };

            serviceMock.Setup(s => s.GetReportArgumentQuery(It.IsAny <int>())).Returns(reportArgumentQuery);

            //act
            var result = reportArgumentQueryController.Get(1);

            //assert
            var viewResult = result.Should().BeAssignableTo <ObjectResult>();

            viewResult.Which.Value.Should().BeEquivalentTo(reportArgumentQuery);
            serviceMock.Verify(s => s.GetReportArgumentQuery(It.IsAny <int>()), Times.Once);
        }