Beispiel #1
0
        public void When_listing_is_purchased_lease_purchase_should_complete()
        {
            var command = new BuyClaimCommand();

            command.GameState = gameState;
            command.Listings  = new ClaimListings();
            var claim      = MineClaim.Default;
            var claimPrice = 1;

            command.Listings.Add(new ClaimListing(claim, claimPrice, 2, SurveyResults.NoSurvey()));
            command.ListingId = command.Listings.GetAll().First().Id;

            var handler = new BuyClaimCommandHandler();

            handler.Handle(command);

            command.Listings.GetAll().Count.ShouldBe(0);
            gameState.Miner.TaterTokens.ShouldBe(MINER_TOKENS - claimPrice);
            gameState.Miner.ClaimLeases.GetAll().Count.ShouldBe(1);
            gameState.Miner.ClaimLeases.GetAll().First().Claim.ShouldBe(claim);

            var output = ConsoleBufferHelper.GetText(proc.Output);

            output.ShouldStartWith($"{1} Purchase Complete!");
        }
Beispiel #2
0
        public void Report_error_message_if_miner_does_not_have_enough_tokens()
        {
            var command = new BuyClaimCommand();

            command.GameState = gameState;
            command.Listings  = new ClaimListings();
            command.Listings.Add(new ClaimListing(MineClaim.Default, MINER_TOKENS + 1, 2, SurveyResults.NoSurvey()));
            command.ListingId = 1;

            var handler = new BuyClaimCommandHandler();

            handler.Handle(command);

            var output = ConsoleBufferHelper.GetText(proc.Output);

            output.ShouldStartWith($"You don't have enough tokens.  You need ");
        }
Beispiel #3
0
        public void Report_error_message_if_listing_id_does_not_exist()
        {
            var command = new BuyClaimCommand();

            command.GameState = gameState;
            command.Listings  = new ClaimListings();
            command.Listings.Add(new ClaimListing(MineClaim.Default, 1, 2, SurveyResults.NoSurvey()));
            command.ListingId = 2;

            var handler = new BuyClaimCommandHandler();

            handler.Handle(command);

            var output = ConsoleBufferHelper.GetText(proc.Output);

            output.ShouldBe($"Listing Id 2 is unavailable.");
        }