private Guid AddPoopingToDb(string author, decimal wagePerHour, TimeSpan duration)
 {
     return(PoopingRepository.Add(new PoopingEntity
     {
         Author = author,
         WagePerHour = wagePerHour,
         Duration = duration,
         ExternalId = Guid.NewGuid()
     }));
 }
        public void AddingEntityWithSameIdThrows()
        {
            var guid1 = AddRandomPoopingToDb();

            Assert.ThrowsException <InvalidOperationException>(() => PoopingRepository.Add(new PoopingEntity
            {
                Author      = "Other random",
                Duration    = TimeSpan.FromSeconds(5),
                ExternalId  = Guid.NewGuid(),
                WagePerHour = 5,
                Id          = guid1
            }));
        }
        public void AddPersistItemInDatabase()
        {
            PoopingRepository.Add(new PoopingEntity
            {
                Author      = "Czesio",
                Duration    = new TimeSpan(0, 0, 5),
                WagePerHour = 15,
                ExternalId  = Guid.NewGuid()
            });

            var pooping = PoopingRepository.GetSingle(e => e.Author == "Czesio");

            Assert.AreNotEqual(new Guid(), pooping.ExternalId, "Guid is not random!");
            Assert.AreEqual(15, pooping.WagePerHour);
            Assert.AreEqual("Czesio", pooping.Author);
            Assert.AreEqual(5, pooping.Duration.TotalSeconds);
        }