public ICategory Build(ICategory category, INoteFactory noteFactory, ISubscriberFactory subscriberFactory)
        {
            if (category == null)
            {
                throw new ArgumentNullException(nameof(category));
            }

            if (noteFactory == null)
            {
                throw new ArgumentNullException(nameof(noteFactory));
            }
            if (subscriberFactory == null)
            {
                throw new ArgumentNullException(nameof(subscriberFactory));
            }

            return(new Category(
                       category.Id,
                       category.Name,
                       category.Created,
                       category.Notes,
                       category.Subscribers,
                       noteFactory,
                       subscriberFactory
                       ));
        }
        public ICategory Create(
            string name,
            INoteFactory noteFactory,
            ISubscriberFactory subscriberFactory
            )
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Invalid argument", nameof(name));
            }
            if (noteFactory == null)
            {
                throw new ArgumentNullException(nameof(noteFactory));
            }
            if (subscriberFactory == null)
            {
                throw new ArgumentNullException(nameof(subscriberFactory));
            }

            return(new Category(
                       name,
                       noteFactory,
                       subscriberFactory
                       ));
        }
        public Category(string name, INoteFactory noteFactory, ISubscriberFactory subscriberFactory)
        {
            Name               = (!string.IsNullOrEmpty(name)) ? name : throw new ArgumentException("New Note must have name.", nameof(name));
            _noteFactory       = noteFactory ?? throw new ArgumentNullException(nameof(noteFactory));
            _subscriberFactory = subscriberFactory ?? throw new ArgumentNullException(nameof(subscriberFactory));

            Created = DateTime.UtcNow;
        }
 public void OneTimeTearDown()
 {
     _noteFactory        = null;
     _subscriberFactory  = null;
     _categoryFactory    = null;
     _categoryRepository = null;
     _mapper             = null;
 }
 public NoteService(INoteFactory noteFactory, IOptions <DatabaseConfigurtaion> options, ILogger <NoteService> logger)
 {
     mNoteFactory           = noteFactory ?? throw new ArgumentNullException(nameof(noteFactory));
     mGeneralNotesDirectory = options.Value.NotesDirectoryPath ??
                              throw new ArgumentNullException(nameof(options.Value.NotesDirectoryPath));
     mTasksNotesDirectory = options.Value.NotesTasksDirectoryPath ??
                            throw new ArgumentNullException(nameof(options.Value.NotesTasksDirectoryPath));
     mLogger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public void OneTimeSetup()
 {
     // ARRANGE
     _noteFactory        = Substitute.For <INoteFactory>();
     _subscriberFactory  = Substitute.For <ISubscriberFactory>();
     _categoryFactory    = Substitute.For <ICategoryFactory>();
     _categoryRepository = Substitute.For <ICategoryRepository>();
     _mapper             = Substitute.For <IMapper>();
 }
Ejemplo n.º 7
0
        public NoteServiceTests()
        {
            ServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.UseTaskerDataEntities();
            serviceCollection.UseJsonObjectSerializer();
            ServiceProvider serviceProvider = serviceCollection
                                              .AddLogging()
                                              .BuildServiceProvider();

            mNoteFactory = serviceProvider.GetRequiredService <INoteFactory>();
        }
 public CentralPanelVM(
     ITimeProvider timeProvider,
     INoteFactory noteFactory,
     IReadOnlyTimer timer,
     DailyTimeCalculation dailyTimeCalculation)
 {
     this.timeProvider         = timeProvider;
     this.noteFactory          = noteFactory;
     this.timer                = timer;
     this.dailyTimeCalculation = dailyTimeCalculation;
     timer.TimeChanged        += OnTimerTimeChanged;
 }
Ejemplo n.º 9
0
        public NoteResourceResponse(string baseDirectory,
                                    IEnumerable <string> notes, INoteFactory noteFactory)
        {
            PossibleNotesRelativePaths = notes.Select(
                path => Path.GetRelativePath(baseDirectory, path));

            if (notes.Count() == 1)
            {
                Note = noteFactory.LoadNote(notes.First());
                return;
            }

            Note = noteFactory.LoadNote(string.Empty);
        }
Ejemplo n.º 10
0
 public NoteTaker(
     INoteFactory noteFactory,
     ISubscriberFactory subscriberFactory,
     ICategoryFactory categoryFactory,
     ICategoryRepository categoryRepository,
     IMapper mapper
     )
 {
     _noteFactory        = noteFactory ?? throw new ArgumentNullException(nameof(noteFactory));
     _subscriberFactory  = subscriberFactory ?? throw new ArgumentNullException(nameof(subscriberFactory));
     _categoryFactory    = categoryFactory ?? throw new ArgumentNullException(nameof(categoryFactory));
     _categoryRepository = categoryRepository ?? throw new ArgumentNullException(nameof(categoryRepository));
     _mapper             = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
 public Category(
     Guid id,
     string name,
     DateTime created,
     IList <INote> notes,
     IList <ISubscriber> subscribers,
     INoteFactory noteFactory,
     ISubscriberFactory subscriberFactory
     )
 {
     Id                 = id;
     Name               = (!string.IsNullOrEmpty(name)) ? name : throw new ArgumentException("New Note must have name.", nameof(name));
     Created            = created;
     Notes              = notes;
     Subscribers        = subscribers;
     _noteFactory       = noteFactory ?? throw new ArgumentNullException(nameof(noteFactory));
     _subscriberFactory = subscriberFactory ?? throw new ArgumentNullException(nameof(subscriberFactory));
 }
Ejemplo n.º 12
0
        public SixStringGuitar(INoteFactory noteFactory)
        {
            Name = "6-String Guitar";
            Presets = new ObservableCollection<IPreset>();

            var standartPreset = CreateAndAddPreset("Standard", new ObservableCollection<INote>
            {
                noteFactory.CreateNote(eNote.E, 4),
                noteFactory.CreateNote(eNote.B, 3),
                noteFactory.CreateNote(eNote.G, 3),
                noteFactory.CreateNote(eNote.D, 3),
                noteFactory.CreateNote(eNote.A, 2),
                noteFactory.CreateNote(eNote.E, 2)
            });
            standartPreset.IsFavorite = true;

            var dropD = CreateAndAddPreset("Drop D", new ObservableCollection<INote>
            {
                noteFactory.CreateNote(eNote.E, 4),
                noteFactory.CreateNote(eNote.B, 3),
                noteFactory.CreateNote(eNote.G, 3),
                noteFactory.CreateNote(eNote.D, 3),
                noteFactory.CreateNote(eNote.A, 2),
                noteFactory.CreateNote(eNote.D, 2)
            });

            var dropC = CreateAndAddPreset("Drop C", new ObservableCollection<INote>
            {
                noteFactory.CreateNote(eNote.D, 4),
                noteFactory.CreateNote(eNote.A, 3),
                noteFactory.CreateNote(eNote.F, 3),
                noteFactory.CreateNote(eNote.C, 3),
                noteFactory.CreateNote(eNote.G, 2),
                noteFactory.CreateNote(eNote.C, 2)
            });
            dropC.IsFavorite = true;

            DefaultSelect();
        }
Ejemplo n.º 13
0
 public NoteFinder(INoteFactory noteFactory)
 {
     NoteFactory = noteFactory;
 }
Ejemplo n.º 14
0
 public void OneTimeTearDown()
 {
     _noteFactory       = null;
     _subscriberFactory = null;
 }
Ejemplo n.º 15
0
 public void OneTimeSetup()
 {
     // ARRANGE
     _noteFactory       = Substitute.For <INoteFactory>();
     _subscriberFactory = Substitute.For <ISubscriberFactory>();
 }