当前位置: 首页>>代码示例>>C#>>正文


C# ModelHelper.CreateMemberUploadError方法代码示例

本文整理汇总了C#中ModelHelper.CreateMemberUploadError方法的典型用法代码示例。如果您正苦于以下问题:C# ModelHelper.CreateMemberUploadError方法的具体用法?C# ModelHelper.CreateMemberUploadError怎么用?C# ModelHelper.CreateMemberUploadError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelHelper的用法示例。


在下文中一共展示了ModelHelper.CreateMemberUploadError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FetchSumissions_ForYearandScheme_ReturnsSubmittedSubmissionsWithCorrectnumberOfWarnings

        public async Task FetchSumissions_ForYearandScheme_ReturnsSubmittedSubmissionsWithCorrectnumberOfWarnings()
        {
            using (DatabaseWrapper database = new DatabaseWrapper())
            {
                ModelHelper helper = new ModelHelper(database.Model);

                // Arrange
                Scheme scheme1 = helper.CreateScheme();
                Scheme scheme2 = helper.CreateScheme();

                var user1 = helper.CreateUser("[email protected]");
                var user2 = helper.CreateUser("[email protected]");

                MemberUpload memberUpload1 = helper.CreateMemberUpload(scheme1);
                memberUpload1.ComplianceYear = 2006;
                memberUpload1.IsSubmitted = true;
                memberUpload1.SubmittedDate = new DateTime(2015, 09, 23, 10, 45, 45);
                memberUpload1.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload2 = helper.CreateMemberUpload(scheme1);
                memberUpload2.ComplianceYear = 2006;
                memberUpload2.IsSubmitted = true;
                memberUpload2.SubmittedDate = new DateTime(2015, 08, 4, 12, 24, 35);
                memberUpload2.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload3 = helper.CreateMemberUpload(scheme1);
                memberUpload3.ComplianceYear = 2006;
                memberUpload3.IsSubmitted = false;
                memberUpload3.SubmittedDate = new DateTime(2015, 08, 10, 12, 25, 32);
                memberUpload3.SubmittedByUserId = user1.Id;

                MemberUpload memberUpload4 = helper.CreateMemberUpload(scheme2);
                memberUpload4.ComplianceYear = 2006;
                memberUpload4.IsSubmitted = true;
                memberUpload4.SubmittedDate = new DateTime(2015, 07, 31, 10, 25, 45);
                memberUpload4.SubmittedByUserId = user2.Id;

                helper.CreateMemberUploadError(memberUpload2);
                helper.CreateMemberUploadError(memberUpload2);

                database.Model.SaveChanges();

                // Act
                GetSubmissionsHistoryResultsDataAccess dataAccess = new GetSubmissionsHistoryResultsDataAccess(database.WeeeContext);
                var results = await dataAccess.GetSubmissionsHistory(scheme1.Id, 2006);

                // Assert
                Assert.NotNull(results.Data);
                Assert.Equal(2, results.Data.Count);
                Assert.Collection(results.Data,
                    r1 => Assert.Equal(0, r1.NoOfWarnings),
                    r2 => Assert.Equal(2, r2.NoOfWarnings));
            }
        }
开发者ID:EnvironmentAgency,项目名称:prsd-weee,代码行数:54,代码来源:GetSubmissionsHistoryResultsDataAccessTests.cs


注:本文中的ModelHelper.CreateMemberUploadError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。