コード例 #1
0
            public void ExistingEntryWithoutUniqueIdIsNotRemoved()
            {
                var repository = Substitute.For <ICalendarRepository>();
                var entries    = new List <JaevnerEntry>();

                entries.Add(new JaevnerEntry
                {
                    StartDateTime = DateTime.Now.AddDays(-2)
                });
                repository.ListEntries().Returns(entries);

                var service = new JaevnerService(repository);

                service.RemoveIrrelevantEntries(entries, 10);

                repository.DidNotReceive().Remove(Arg.Any <JaevnerEntry>());
            }
コード例 #2
0
            public void ExistingEntryThatIsNotOlderThanNumberOfDaysToKeepIsKept()
            {
                const string uniqueId   = "123456";
                var          repository = Substitute.For <ICalendarRepository>();
                var          entries    = new List <JaevnerEntry>();

                entries.Add(new JaevnerEntry
                {
                    UniqueId      = uniqueId,
                    StartDateTime = DateTime.Now.AddDays(-2)
                });
                repository.ListEntries().Returns(entries);

                var service = new JaevnerService(repository);

                service.RemoveIrrelevantEntries(entries, 10);

                repository.DidNotReceive().Remove(Arg.Is <JaevnerEntry>(e => e.UniqueId.Equals(uniqueId)));
            }
コード例 #3
0
            public void ExistingEntryInCalendarThatIsNotIncludedInNewDataIsDeleted()
            {
                const string uniqueId   = "123456";
                var          repository = Substitute.For <ICalendarRepository>();

                repository.ListEntries().Returns(new List <JaevnerEntry>
                {
                    new JaevnerEntry
                    {
                        UniqueId = uniqueId
                    }
                });

                var service = new JaevnerService(repository);

                service.RemoveIrrelevantEntries(new List <JaevnerEntry>(), 5);

                repository.Received().Remove(Arg.Is <JaevnerEntry>(e => e.UniqueId.Equals(uniqueId)));
            }