Exemplo n.º 1
0
        public GetAll()
        {
            _fakeRepository = new FakeHorseRepository();
            HorseFactory.Create(_fakeRepository);

            _horseService = new HorseService(_fakeRepository);
        }
Exemplo n.º 2
0
        private HorseFactory GetHorseFactory()
        {
            HorseFactory horseFactory = HorseFactoryGrid.SelectedItem as HorseFactory;

            if (horseFactory != null)
            {
                return(managementSystem.Library.HorseFactories.Get <HorseFactory> (horseFactory.Id));
            }
            return(null);
        }
Exemplo n.º 3
0
        private void HorseFactoryTab_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            HorseFactory horseFactory = HorseFactoryGrid.SelectedItem as HorseFactory;

            if (horseFactory == null)
            {
                return;
            }
            horseFactoryWindow           = new HorseFactoryWindow(horseFactory);
            horseFactoryWindow.Title     = string.Format("Horse Factory - Id: {0}, Name: {1}", horseFactory.Id, horseFactory.Name);
            horseFactoryWindow.OnAdd    += managementSystem.Library.HorseFactories.Add;
            horseFactoryWindow.OnUpdate += managementSystem.Library.HorseFactories.Update;
            horseFactoryWindow.Show();
        }
Exemplo n.º 4
0
        public void ItReturnsHorseFromRepository(int id, string name)
        {
            // Arrange
            var expectedHorse = HorseFactory.Create(_fakeRepository, id, name).WithColor();
            var service       = new HorseService(_fakeRepository);

            // Act
            var actualHorse = service.Get(expectedHorse.Id);

            // Assert
            Assert.True(_fakeRepository.GetCalled);
            Assert.Equal(expectedHorse.Id, actualHorse.Id);
            Assert.Equal(expectedHorse.Name, actualHorse.Name);
        }
 private void buttonUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (oldHorseFactory != null)
     {
         if (CheckInformationFields())
         {
             HorseFactory horseFactory = GetHorseFactory();
             horseFactory.Id = oldHorseFactory.Id;
             OnUpdate?.Invoke(horseFactory, oldHorseFactory.Id);
             MessageBox.Show("Contest was successfully updated in the database.");
             this.Close();
         }
     }
 }
Exemplo n.º 6
0
        public void TestSetup()
        {
            HorseFactory.Create(Context).WithColor().WithDam().WithSire();

            _horseService = Container.Resolve <IHorseService>();
        }
 public HorseFactoryWindow(HorseFactory horseFactoryToChange)
 {
     InitializeComponent();
     oldHorseFactory = horseFactoryToChange;
     ShowOldContestInformation();
 }