Exemplo n.º 1
0
        void 読み込み開始場所を指定することができる(int startPosition)
        {
            var ConnpassDatastoreMoq          = new Mock <IConnpassReadOnlyWebsiteDataRepository>();
            var ConnpassDatabaseRepositoryMoq = new Mock <IConnpassDatabaseRepository>();

            var usecase =
                new RefreshSpecificConnpassEventData(ConnpassDatastoreMoq.Object, ConnpassDatabaseRepositoryMoq.Object);

            ConnpassDatastoreMoq.Setup(obj => obj.LoadSpecificConnpassDataAsync(startPosition))
            .ReturnsAsync(new List <ConnpassEventDataEntity>());

            usecase.Execute(startPosition);

            ConnpassDatastoreMoq.Verify(obj => obj.LoadSpecificConnpassDataAsync(startPosition), Times.Once);
        }
Exemplo n.º 2
0
        void 指定されないとポジション1から100個のイベントが読み込まれる()
        {
            var ConnpassDatastoreMoq          = new Mock <IConnpassReadOnlyWebsiteDataRepository>();
            var ConnpassDatabaseRepositoryMoq = new Mock <IConnpassDatabaseRepository>();

            var usecase =
                new RefreshSpecificConnpassEventData(ConnpassDatastoreMoq.Object, ConnpassDatabaseRepositoryMoq.Object);

            ConnpassDatastoreMoq.Setup(obj => obj.LoadSpecificConnpassDataAsync(1))
            .ReturnsAsync(new List <ConnpassEventDataEntity>());

            usecase.Execute();

            ConnpassDatastoreMoq.Verify(obj => obj.LoadSpecificConnpassDataAsync(1), Times.Once);
        }
Exemplo n.º 3
0
        async Task Connpassから読み込んだデータをデータベースに保存している()
        {
            var ConnpassDatastoreMoq          = new Mock <IConnpassReadOnlyWebsiteDataRepository>();
            var ConnpassDatabaseRepositoryMoq = new Mock <IConnpassDatabaseRepository>();

            var dummyDataList = new List <ConnpassEventDataEntity>();

            Enumerable.Range(0, 100).Select(i => new ConnpassEventDataEntity()).ToList()
            .ForEach(item => dummyDataList.Add(item));

            ConnpassDatastoreMoq.Setup(obj => obj.LoadSpecificConnpassDataAsync(1)).ReturnsAsync(dummyDataList);
            ConnpassDatabaseRepositoryMoq.Setup(obj => obj.SaveEventData(dummyDataList)).Returns(Task.CompletedTask);

            var usecase =
                new RefreshSpecificConnpassEventData(ConnpassDatastoreMoq.Object, ConnpassDatabaseRepositoryMoq.Object);

            await usecase.Execute();

            ConnpassDatabaseRepositoryMoq.Verify(obj => obj.SaveEventData(dummyDataList), Times.Once);
        }