public void Sell(Customer customer, Sales sales, CampaignServices campaignServices)
 {
     Console.WriteLine("-----------------------------------");
     Console.Write("Satın Alınan Oyun ve Kampanya Bilgisi \n");
     Console.Write(customer.Ad + " " + customer.Soyad + "\n");
     Console.WriteLine(sales.SalesId);
     Console.Write("Ücret:" + sales.SalePrice + "\n");
     campaignServices.MakeCampaign();
 }
        public void WriteCampaignToWriter()
        {
            //Arrange
            var mock        = new Mock <IRepository <Campaign> >();
            var saleMock    = new Mock <IRepository <Sale> >();
            var uowMock     = new Mock <IUnitOfWork>();
            var consoleMock = new Mock <IConsoleWriter>();

            mock.Setup(x => x.Get(It.IsAny <Expression <Func <Campaign, bool> > >()))
            .Returns(new Campaign {
                ProductCode = "P1", Name = "C1", Status = Status.Active, Duration = 5
            }).Verifiable();
            var campaignService = new CampaignServices(mock.Object, saleMock.Object, uowMock.Object, consoleMock.Object);

            //Act
            campaignService.GetCampaign("C1");

            //Assert
            consoleMock.Verify(x => x.Write(It.IsAny <string>()), Times.Once);
        }
        public void CreateCampaign()
        {
            //Arrange
            var mock        = new Mock <IRepository <Campaign> >();
            var saleMock    = new Mock <IRepository <Sale> >();
            var uowMock     = new Mock <IUnitOfWork>();
            var consoleMock = new Mock <IConsoleWriter>();

            mock.Setup(x => x.Add(It.IsAny <Campaign>()))
            .Returns(new Campaign {
                ProductCode = "P1", Name = "C1", Status = Status.Active, Duration = 5
            }).Verifiable();
            var campaignService = new CampaignServices(mock.Object, saleMock.Object, uowMock.Object, consoleMock.Object);

            //Act
            campaignService.CreateCampaign("C1", "P1", 10, 20, 100);

            //Assert
            uowMock.Verify(x => x.Commit(), Times.Once);
        }
        public void AddCreateCampaignEvent()
        {
            //Arrange
            var mock        = new Mock <IRepository <Campaign> >();
            var saleMock    = new Mock <IRepository <Sale> >();
            var uowMock     = new Mock <IUnitOfWork>();
            var consoleMock = new Mock <IConsoleWriter>();

            mock.Setup(x => x.Add(It.IsAny <Campaign>()))
            .Returns(new Campaign {
                ProductCode = "P1", Name = "C1", Status = Status.Active, Duration = 5
            }).Verifiable();
            var campaignService = new CampaignServices(mock.Object, saleMock.Object, uowMock.Object, consoleMock.Object);

            //Act
            campaignService.CreateCampaign("C1", "P1", 10, 20, 100);
            var events = DomainEventRepository.FindAll();

            //Assert
            Assert.Contains(events, x => x.Type == typeof(AddNewCampaignEvent));
        }
        public void AddCreateCampaignEventShouldNotEmptyMessage()
        {
            //Arrange
            var mock        = new Mock <IRepository <Campaign> >();
            var saleMock    = new Mock <IRepository <Sale> >();
            var uowMock     = new Mock <IUnitOfWork>();
            var consoleMock = new Mock <IConsoleWriter>();

            mock.Setup(x => x.Add(It.IsAny <Campaign>()))
            .Returns(new Campaign {
                ProductCode = "P1", Name = "C1", Status = Status.Active, Duration = 5
            }).Verifiable();
            var campaignService = new CampaignServices(mock.Object, saleMock.Object, uowMock.Object, consoleMock.Object);

            //Act
            campaignService.CreateCampaign("C1", "P1", 10, 20, 100);
            var events      = DomainEventRepository.FindAll();
            var domainEvent = events.FirstOrDefault(x => x.Type == typeof(AddNewCampaignEvent)).Event as AddNewCampaignEvent;

            //Assert
            Assert.False(string.IsNullOrEmpty(domainEvent.Message));
        }
예제 #6
0
 public void Add(CampaignServices campaign)
 { 
     Console.WriteLine("Kampanya Eklendi.");
 }
예제 #7
0
 public void Delete(CampaignServices campaign)
 {
     Console.WriteLine("Kampanya Silindi.");
 }
예제 #8
0
 public void Update (CampaignServices campaign)
 {
     Console.WriteLine("Kampanya Güncellendi.");
 }