<commit_before>﻿module TestAppointmentRepository

open System
open NUnit.Framework
open FsUnit
open System.Threading.Tasks
open sync.today.Models

[<TestFixture>] 
type ``appointment persistence`` ()=
    //[<BeforeTest>] member x.

    let logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

    [<TestFixtureSetUp>] member x.``Log Test At the beginning`` ()=         
            logger.Info("Test")

    [<Test>] member x.``when I ask for appointments it should not be Null.`` ()=
            AppointmentRepository.Appointments() |> should not' (be Null)

    [<Test>] member x.``when I ask for appointments it should have zero members first.`` ()=
             AppointmentRepository.DeleteAppointments()
             AppointmentRepository.Appointments().IsEmpty |> should be True

    [<Test>] member x.``when I ask for appointments and insert one it should have more then zero members.`` ()=
             let appointment = { Id = -1; ExternalId = "externalId"; LastModified = DateTime.Now; Category="";Location="";Content="";Title=""; DateFrom=DateTime.Now; DateTo=DateTime.Now; Reminder=Nullable<DateTime>(); Notification=false; IsPrivate=false; Priority=byte 0}
             AppointmentRepository.InsertAppointment( appointment )
             AppointmentRepository.Appointments().IsEmpty |> should not' (be True)

    [<Test>] member x.``when another Thread is logging, the appointments should be saved as well.`` () =
             let appointment = { Id = -1; ExternalId = "externalId"; LastModified = DateTime.Now; Category="";Location="";Content="";Title=""; DateFrom=DateTime.Now; DateTo=DateTime.Now; Reminder=Nullable<DateTime>(); Notification=false; IsPrivate=false; Priority=byte 0}
            Parallel.ForEach([1;2], fun x-> 
                                        AppointmentRepository.InsertAppointment( appointment )
                                        AppointmentRepository.Appointments().IsEmpty |> should not' (be True)
                                        ) |> ignore            <commit_msg>fixed typo in Appointment tests<commit_after>﻿module TestAppointmentRepository

open System
open NUnit.Framework
open FsUnit
open System.Threading.Tasks
open sync.today.Models

[<TestFixture>] 
type ``appointment persistence`` ()=
    //[<BeforeTest>] member x.

    let logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

    [<TestFixtureSetUp>] member x.``Log Test At the beginning`` ()=         
            logger.Info("Test")

    [<Test>] member x.``when I ask for appointments it should not be Null.`` ()=
            AppointmentRepository.Appointments() |> should not' (be Null)

    [<Test>] member x.``when I ask for appointments it should have zero members first.`` ()=
             AppointmentRepository.DeleteAppointments()
             AppointmentRepository.Appointments().IsEmpty |> should be True

    [<Test>] member x.``when I ask for appointments and insert one it should have more then zero members.`` ()=
             let appointment = { Id = -1; ExternalId = "externalId"; LastModified = DateTime.Now; Category="";Location="";Content="";Title=""; DateFrom=DateTime.Now; DateTo=DateTime.Now; Reminder=Nullable<DateTime>(); Notification=false; IsPrivate=false; Priority=byte 0}
             AppointmentRepository.InsertAppointment( appointment )
             AppointmentRepository.Appointments().IsEmpty |> should not' (be True)

    [<Test>] member x.``when another Thread is logging, the appointments should be saved as well.`` () =
             let appointment = { Id = -1; ExternalId = "externalId"; LastModified = DateTime.Now; Category="";Location="";Content="";Title=""; DateFrom=DateTime.Now; DateTo=DateTime.Now; Reminder=Nullable<DateTime>(); Notification=false; IsPrivate=false; Priority=byte 0}
             Parallel.ForEach([1;2], fun x-> 
                                        AppointmentRepository.InsertAppointment( appointment )
                                        AppointmentRepository.Appointments().IsEmpty |> should not' (be True)
                                        ) |> ignore            
{'fraction_non_alphanumeric': 0.12143028557715382, 'fraction_numerical': 0.00335973122150228, 'mean_word_length': 3.0782778864970646, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6984638', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1057, 'n_words': 296}