예제 #1
0
		public void GetCustomerBets_WhenRepositoryDataIsNull_ReturnNull()
		{
			// Arrange
			var stubRepository = MockRepository.GenerateStub<ISettledRepository>();
			stubRepository.Stub(x => x.GetData("")).IgnoreArguments().Return(null);

			// Act
			var sut = new SettledBetService(stubRepository);
			var result = sut.GetCustomerBets("");

			// Assert
			Assert.IsNull(result);
		}
예제 #2
0
		public void GetCustomerBets_WhenRepositoryDataIsNotNull_ReturnList()
		{
			// Arrange
			var stubData = new List<SettledBet>
			{
				new SettledBet{CustomerId = 1, EventId = 1, PartipantId = 1, Stake = 10m, Win = 50m},
				new SettledBet{CustomerId = 1, EventId = 1, PartipantId = 1, Stake = 50m, Win = 0}
			};

			var stubRepository = MockRepository.GenerateStub<ISettledRepository>();
			stubRepository.Stub(x => x.GetData("")).IgnoreArguments().Return(stubData);

			// Act
			var sut = new SettledBetService(stubRepository);
			var result = sut.GetCustomerBets("");

			// Assert
			Assert.AreEqual(2, result.Count());
		}
예제 #3
0
		public void GetAllCustomerWinsOverThreshold_WhenWinsAreExactly60PercentOfBets_ReturnNone()
		{
			// Arrange
			var stubData = new List<SettledBet>
			{
				new SettledBet{CustomerId = 1, Win = 50m},
				new SettledBet{CustomerId = 1, Win = 0},
				new SettledBet{CustomerId = 1, Win = 10m},
				new SettledBet{CustomerId = 1, Win = 0},
				new SettledBet{CustomerId = 1, Win = 5m}
			};

			var stubRepository = MockRepository.GenerateStub<ISettledRepository>();
			stubRepository.Stub(x => x.GetData("")).IgnoreArguments().Return(stubData);

			// Act
			var sut = new SettledBetService(stubRepository);
			var result = sut.GetAllCustomerWinsOverThreshold("");

			// Assert
			Assert.AreEqual(0, result.Count());
		}