コード例 #1
0
        public void ThrowArgumentNullException_WhenILeaderboardViewModelFactoryParameterIsNull()
        {
            // Arrange
            var outputPerSecondViewModelDataProvider = new Mock <IOutputPerSecondViewModelDataProvider>();
            var partialCircleSvgPathProvider         = new Mock <IPartialCircleSvgPathProvider>();
            ILeaderboardViewModelFactory leaderboardViewModelFactory = null;

            // Act & Assert
            Assert.That(
                () => new LeaderboardService(outputPerSecondViewModelDataProvider.Object, partialCircleSvgPathProvider.Object, leaderboardViewModelFactory),
                Throws.InstanceOf <ArgumentNullException>().With.Message.Contains(nameof(ILeaderboardViewModelFactory)));
        }
コード例 #2
0
        public void ThrowArgumentNullException_WhenAllParametersAreNull()
        {
            // Arrange
            IOutputPerSecondViewModelDataProvider outputPerSecondViewModelDataProvider = null;
            IPartialCircleSvgPathProvider         partialCircleSvgPathProvider         = null;
            ILeaderboardViewModelFactory          leaderboardViewModelFactory          = null;

            // Act & Assert
            Assert.That(
                () => new LeaderboardService(outputPerSecondViewModelDataProvider, partialCircleSvgPathProvider, leaderboardViewModelFactory),
                Throws.InstanceOf <ArgumentNullException>());
        }
コード例 #3
0
        public LeaderboardService(IOutputPerSecondViewModelDataProvider outputPerSecondViewModelDataProvider, IPartialCircleSvgPathProvider partialCircleSvgPathProvider, ILeaderboardViewModelFactory leaderboardViewModelFactory)
        {
            Guard.WhenArgument(outputPerSecondViewModelDataProvider, nameof(IOutputPerSecondViewModelDataProvider)).IsNull().Throw();
            Guard.WhenArgument(partialCircleSvgPathProvider, nameof(IPartialCircleSvgPathProvider)).IsNull().Throw();
            Guard.WhenArgument(leaderboardViewModelFactory, nameof(ILeaderboardViewModelFactory)).IsNull().Throw();

            this.partialCircleSvgPathProvider = partialCircleSvgPathProvider;
            this.leaderboardViewModelFactory  = leaderboardViewModelFactory;

            this.getTopDamageOnPageInDescendingOrderDataProviderMethod  = outputPerSecondViewModelDataProvider.GetTopDamageOnPageInDescendingOrder;
            this.getTopHealingOnPageInDescendingOrderDataProviderMethod = outputPerSecondViewModelDataProvider.GetTopHealingOnPageInDescendingOrder;
        }