예제 #1
0
        public async Task RealisticBothSourcesOfDks(int baseCount)
        {
            _UtcDateTimeProviderMock.Setup(x => x.Snapshot).Returns(DateTime.UtcNow);
            _IksConfigMock.Setup(x => x.PageSize).Returns(10);

            var gen   = new DiagnosisKeyTestDataGenerator(_DkSourceDbProvider);
            var items = gen.Write(gen.LocalDksForLocalPeople(gen.GenerateDks(baseCount)));

            gen.Write(gen.AlreadyPublished(gen.GenerateDks(baseCount)));
            gen.Write(gen.NotLocal(gen.GenerateDks(baseCount)));

            var gen2 = new IksDkSnapshotTestDataGenerator(_IksPublishingDbProvider);

            gen2.Write(gen2.GenerateInput(items));

            Assert.Equal(baseCount, _IksPublishingDbProvider.CreateNew().Input.Count());
            Assert.Equal(baseCount * 3, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count());
            Assert.Equal(baseCount * 2, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count(x => x.PublishedToEfgs));

            var c      = Create();
            var result = await c.ExecuteAsync();

            Assert.Equal(baseCount, result.Count);                                                                    //Affected
            Assert.Equal(baseCount, _IksPublishingDbProvider.CreateNew().Input.Count());                              //Unchanged
            Assert.Equal(baseCount * 3, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count());                       //Unchanged
            Assert.Equal(baseCount * 3, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count(x => x.PublishedToEfgs)); //
        }
예제 #2
0
        public async Task Simple(int baseCount)
        {
            _UtcDateTimeProviderMock.Setup(x => x.Snapshot).Returns(DateTime.UtcNow);
            _IksConfigMock.Setup(x => x.PageSize).Returns(10);

            var gen   = new DiagnosisKeyTestDataGenerator(_DkSourceDbProvider);
            var items = gen.Write(gen.LocalDksForLocalPeople(gen.GenerateDks(baseCount)));

            var gen2 = new IksDkSnapshotTestDataGenerator(_IksPublishingDbProvider);

            gen2.Write(gen2.GenerateInput(items));

            Assert.Equal(baseCount, _IksPublishingDbProvider.CreateNew().Input.Count());
            Assert.Equal(baseCount, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count());
            Assert.Equal(0, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count(x => x.PublishedToEfgs));

            var result = await Create().ExecuteAsync();

            Assert.Equal(baseCount, result.Count);
            Assert.Equal(baseCount, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count(x => x.PublishedToEfgs));
            Assert.Equal(baseCount, _DkSourceDbProvider.CreateNew().DiagnosisKeys.Count());
        }