Esempio n. 1
0
        public async Task GetCurrentPrize_ReturnCurrentPrize()
        {
            // arrange
            _storageMock
            .Setup(x => x.AddItemToRepository(It.IsAny <RafflePrize>()))
            .ReturnsAsync(0);
            _storageMock.SetupProperty(x => x.IsInitialized).SetReturnsDefault(true);

            var prize = new RafflePrize {
                Name = "Current Prize", Quantity = 1, IsSelectedPrize = true
            };
            var svc = new PrizeService(_storageMock.Object, _loggerMock.Object);
            await svc.InitializeService();

            var result = await svc.AddRafflePrize(prize);

            // act
            var selected = await svc.GetCurrentPrize();

            // assert
            Assert.IsNotNull(selected);
            Assert.AreEqual(prize.Name, "Current Prize");
        }