예제 #1
0
		public async Task WhenValidPasswordHasBeenPassed_NewEmailAlreadyExists_UpdateEmailDoesNotChangeTheEmail()
		{
			var errorNotifier = new FakeErrorNotifier();

			await mTestedService.UpdateUserEmail("1", "Password", "*****@*****.**", errorNotifier);

			var user = ReadUserFromDatabase("1");

			Assert.That(errorNotifier.IsInErrorState);
			Assert.That(user.Email, Is.EqualTo("*****@*****.**"));
		}
		public async Task WhenTryingToBuyoutAnAuctionWithoutBuyoutEnabled_ValidationErrorIsReturned()
		{
			var auction = AddAuctionToDatabase(new TestAuction
			{
				SellerId = "2",
				EndDate  = DateTime.Now.Add(TimeSpan.FromDays(2)),
			});

			var errors = new FakeErrorNotifier();

			await mTestedService.Buyout(auction.Id, buyerId: "1", errors: errors);

			Assert.That(errors.IsInErrorState, Is.True);
		}
		public async Task WhenAuctionCannotBeBought_BidReturnsValidationError()
		{
			var auction = AddAuctionToDatabase(new TestAuction
			{
				SellerId     = "1",
				EndDate      = DateTime.Now.Add(TimeSpan.FromDays(2)),
				MinimumPrice = new Money(100.0m, new TestCurrency()),
			});

			var errors = new FakeErrorNotifier();

			await mTestedService.Bid(auction.Id, buyerId: "1", bidAmount: 110.0m, errors: errors);

			Assert.That(errors.IsInErrorState, Is.True);
		}
		public async Task WhenBidAmountIsLowerThanMinimumAllowedBid_ValidationErrorIsReturned()
		{
			var auction = AddAuctionToDatabase(new TestAuction
			{
				SellerId     = "2",
				EndDate      = DateTime.Now.Add(TimeSpan.FromDays(2)),
				MinimumPrice = new Money(100.0m, new TestCurrency()),
				Offers       = new BuyOffer[] { new TestBuyOffer { Amount = 150.0m } }
			});

			var errors = new FakeErrorNotifier();

			await mTestedService.Bid(auction.Id, buyerId: "1", bidAmount: 150.0m, errors: errors);

			Assert.That(errors.IsInErrorState, Is.True);
		}
예제 #5
0
		public async Task WhenValidPasswordHasBeenPassed_EmailIsTheSameAsBefore_NoErrorIsRaised()
		{
			var errorNotifier = new FakeErrorNotifier();

			await mTestedService.UpdateUserEmail("1", "Password", "*****@*****.**", errorNotifier);

			Assert.That(!errorNotifier.IsInErrorState);
		}