Ejemplo n.º 1
0
            public void NewEntryIsAddedToRepository()
            {
                var repository = Substitute.For <ICalendarRepository>();

                repository.ListEntries().Returns(new List <JaevnerEntry>());
                const string uniqueId = "123456";

                var service = new JaevnerService(repository);

                var entries = new List <JaevnerEntry>();

                entries.Add(new JaevnerEntry {
                    UniqueId = "123456", StartDateTime = DateTime.Now
                });
                service.ProcessEntries(entries);

                repository.Received().Insert(Arg.Is <JaevnerEntry>(e => e.UniqueId.Equals(uniqueId)));
            }
Ejemplo n.º 2
0
            public void ExistingEntryIsUpdated()
            {
                const string uniqueId = "123456";
                var          entries  = new List <JaevnerEntry>();

                entries.Add(new JaevnerEntry {
                    UniqueId = uniqueId, StartDateTime = DateTime.Now
                });
                var repository = Substitute.For <ICalendarRepository>();

                repository.EntryExists(uniqueId).Returns(true);

                var service = new JaevnerService(repository);

                service.ProcessEntries(entries);

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