コード例 #1
0
        public void DeleteSpentTime()
        {
            using (var fixture = new FixtureInit("http://localhost"))
            {
                //INIT
                var repository = new SpentTimesRepository(fixture.Setup.Context);

                var spentTime = new SpentTime()
                {
                    Amount      = 30,
                    Description = "Test description 1",
                    ProjectId   = fixture.Setup.Project.Id
                };

                repository.Save(spentTime);

                //ACT
                repository.Delete(spentTime);

                //POST
                var foundSpentTime = repository.SpentTimes.WithId(spentTime.Id);
                Assert.That(foundSpentTime, Is.Null);
            }
        }
コード例 #2
0
        public void InsertSpentTime()
        {
            using (var fixture = new FixtureInit("http://localhost"))
            {
                //INIT
                var repository = new SpentTimesRepository(fixture.Setup.Context);

                //ACT
                var spentTime = new SpentTime()
                {
                    Amount      = 30,
                    Description = "Test description 1",
                    ProjectId   = fixture.Setup.Project.Id
                };

                repository.Save(spentTime);

                //POST
                var actual = repository.SpentTimes.WithId(spentTime.Id);
                Assert.That(actual, Is.Not.Null);
                Assert.That(actual.Description, Is.EqualTo("Test description 1"));
                Assert.That(actual.ProjectId, Is.EqualTo(fixture.Setup.Project.Id));
            }
        }