Example #1
0
        public void GetDamageReportTest()
        {
            DamageReport dr = DamageReportFactory.NewDamageReport();

            string token = UsingDbContext(context => DamageReportsMockDatabaseHelper.AddDamageReport(dr, context));

            DamageReportCompleteOutputDto queryresult = _damageReportAppService.Get(dr.Id, token);

            Assert.Equal(queryresult.Description, dr.Description);
        }
Example #2
0
        public void GetDamageReportsWithPriorityTest()
        {
            DamageReport dr = DamageReportFactory.NewDamageReport();

            dr.Priority = DamagePriority.Medium;

            string token = UsingDbContext(context => DamageReportsMockDatabaseHelper.AddDamageReport(dr, context));

            List <DamageReportOutputDto> queryResult = _damageReportAppService.GetWithPriority(token, DamageReportPriorityDto.Medium);

            Assert.Equal(dr.Description, queryResult.First().Description);
            Assert.Equal(DamageReportPriorityDto.Medium, queryResult.First().Priority);
        }
Example #3
0
        public void GetDamageReportsTest()
        {
            var drs = new List <DamageReport>
            {
                DamageReportFactory.NewDamageReport(),
                DamageReportFactory.NewDamageReport()
            };

            string token = UsingDbContext(context =>
            {
                drs.ForEach(dr => context.DamageReports.Add(dr));
                return(DamageReportsMockDatabaseHelper.AddDamageReport(DamageReportFactory.NewDamageReport(), context));
            });

            var result = _damageReportAppService.GetAll(token);

            Assert.Equal(3, result.Count);
        }
        public void ModifyDamageReportTests()
        {
            DamageReport dr = DamageReportFactory.NewDamageReport();

            string token = UsingDbContext(context => DamageReportsMockDatabaseHelper.AddDamageReport(dr, context));

            _damageReportAppService.ModifyDamageReport(token, dr.Id, new ModifyDamageReportDto
            {
                Priority = DamageReportPriorityDto.High,
                Status   = DamageStatusDto.Accepted
            });

            UsingDbContext(context =>
            {
                DamageReport savedDamage = context.DamageReports.First();

                Assert.Equal(DamagePriority.High, savedDamage.Priority);
                Assert.Equal(DamageStatus.Accepted, savedDamage.Status);
            });
        }