コード例 #1
0
        public async Task UpdateExistingSharedState_SetsUpdatedTime()
        {
            Instant createdInstant = SystemClock.Instance.GetCurrentInstant();
            //Arrange
            FakeClock             fakeClock  = new FakeClock(createdInstant);
            SharedStateController controller = new SharedStateController(new TestDatabaseHandler <SharedState.SharedState>(), fakeClock);
            string         anchorSetId       = "anchorSetId";
            string         spaceid           = "spaceId";
            SharedStateDto sharedState       = new SharedStateDto(new SharedState.SharedState()
            {
                Id = anchorSetId,
                CurrentSelectedSpace = spaceid
            });

            //Act
            await controller.UpdateSharedState(anchorSetId, sharedState);

            fakeClock.AdvanceMinutes(1);
            await controller.UpdateSharedState(anchorSetId, sharedState);

            //Assert
            SharedState.SharedState fetchedState = await controller.GetSharedState(anchorSetId);

            fetchedState.CreatedAt.Should().Be(createdInstant);
            fetchedState.UpdatedAt.Should().Be(createdInstant.Plus(Duration.FromMinutes(1)));
        }
コード例 #2
0
        public async Task SetSharedState()
        {
            //Arrange
            SharedStateController controller = new SharedStateController(new TestDatabaseHandler <SharedState.SharedState>(), SystemClock.Instance);
            string         anchorSetId       = "anchorSetId";
            string         spaceid           = "spaceId";
            SharedStateDto sharedState       = new SharedStateDto(new SharedState.SharedState()
            {
                Id = anchorSetId,
                CurrentSelectedSpace = spaceid
            });

            //Act
            await controller.UpdateSharedState(anchorSetId, sharedState);

            //Assert
            SharedState.SharedState fetchedState = await controller.GetSharedState(anchorSetId);

            fetchedState.Id.Should().Be(anchorSetId);
            fetchedState.CurrentSelectedSpace.Should().Be(spaceid);
        }
コード例 #3
0
        public async Task UpdateSharedState_SetsCreatedTimeAndUpdatedTime()
        {
            Instant createdInstant = SystemClock.Instance.GetCurrentInstant();
            //Arrange
            SharedStateController controller = new SharedStateController(new TestDatabaseHandler <SharedState.SharedState>(), new FakeClock(createdInstant));
            string         anchorSetId       = "anchorSetId";
            string         spaceid           = "spaceId";
            SharedStateDto sharedState       = new SharedStateDto(new SharedState.SharedState()
            {
                Id = anchorSetId,
                CurrentSelectedSpace = spaceid
            });

            //Act
            await controller.UpdateSharedState(anchorSetId, sharedState);

            //Assert
            SharedState.SharedState fetchedState = await controller.GetSharedState(anchorSetId);

            fetchedState.CreatedAt.Should().Be(createdInstant);
            fetchedState.UpdatedAt.Should().Be(createdInstant);
        }