public void NoteModelExtensionsClassToNoteMethodReturnsObjectWithCorrectDefinitionProperty()
        {
            NoteModel testObject = GetRandomNoteModel();

            Note testResult = testObject.ToNote();

            Assert.AreEqual(testObject.Definition, testResult.Definition);
        }
        public void NoteModelExtensionsClassToNoteMethodReturnsObjectWithCorrectAppliesToTimingsProperty()
        {
            NoteModel testObject = GetRandomNoteModel();

            Note testResult = testObject.ToNote();

            Assert.AreEqual(testObject.AppliesToTimings, testResult.AppliesToTimings);
        }
        public void NoteModelExtensionsClassToNoteMethodReturnsObjectIfParameterIsNotNull()
        {
            NoteModel testObject = GetRandomNoteModel();

            Note testResult = testObject.ToNote();

            Assert.IsNotNull(testResult);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ThrowsArgumentNullException_IfParameterIsNull()
        {
            NoteModel testObject = null;

            _ = testObject.ToNote();

            Assert.Fail();
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ReturnsObjectWithCorrectDefinitionProperty_IfParameterIsNotNull()
        {
            NoteModel testParam = GetModel();

            Note testOutput = testParam.ToNote();

            Assert.AreEqual(testParam.Definition, testOutput.Definition);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ThrowsNullReferenceException_IfParameterIsNull()
        {
            NoteModel testParam = null;

            _ = testParam.ToNote();

            Assert.Fail();
        }
Ejemplo n.º 7
0
        public void AddNote(NoteModel noteModel)
        {
            User userDb = ValidateNoteModel(noteModel);

            Note noteForDb = noteModel.ToNote();

            noteForDb.User = userDb;
            _noteRepository.Add(noteForDb);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ReturnsObjectWithCorrectAppliesToTimingsProperty_IfParameterHasAppliesToTimingsPropertyThatIsNotNull()
        {
            NoteModel testParam = GetModel();

            testParam.AppliesToTimings = _rnd.NextBoolean();

            Note testOutput = testParam.ToNote();

            Assert.AreEqual(testParam.AppliesToTimings.Value, testOutput.AppliesToTimings);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ReturnsObjectWithAppliesToTrainsPropertyEqualToFalse_IfParameterHasAppliesToTrainsPropertyThatIsNull()
        {
            NoteModel testParam = GetModel();

            testParam.AppliesToTrains = null;

            Note testOutput = testParam.ToNote();

            Assert.IsFalse(testOutput.AppliesToTrains);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ReturnsObjectWithDefinedOnPagesPropertyEqualToFalse_IfParameterHasDefinedOnPagesPropertyThatIsNull()
        {
            NoteModel testParam = GetModel();

            testParam.DefinedOnPages = null;

            Note testOutput = testParam.ToNote();

            Assert.IsFalse(testOutput.DefinedOnPages);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ReturnsObjectWithCorrectDefinedOnPagesProperty_IfParameterHasDefinedOnPagesPropertyThatIsNotNull()
        {
            NoteModel testParam = GetModel();

            testParam.DefinedOnPages = _rnd.NextBoolean();

            Note testOutput = testParam.ToNote();

            Assert.AreEqual(testParam.DefinedOnPages.Value, testOutput.DefinedOnPages);
        }
        public void NoteModelExtensionsClass_ToNoteMethod_ThrowsArgumentNullExceptionWithCorrectParamNameProperty_IfParameterIsNull()
        {
            NoteModel testObject = null;

            try
            {
                _ = testObject.ToNote();
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("model", ex.ParamName);
            }
        }