title: F#: how to have the variables defined above a XUnit test function actually initialized when running the test?
body: <p>Following up another question: <a href="https://stackoverflow.com/questions/56484369/f-why-those-two-collections-are-not-equal">F#: Why those two collections are not equal?</a> the example below shows that when running <code>Open an account...</code> test <code>id</code> and <code>contact</code> are not initialized.</p>
  
  <p>If there were functions returning the same values and called in the test body it would work though.</p>
  
  <p>I am wondering why this is case, and if there is anything I can do to have those variables properly initialized when the test is running.</p>
  
  <pre class="lang-ml prettyprint-override"><code>let id = Guid.Empty
  let contact = {
      Name = {
          FirstName = "Marcel"
          MiddleInitial = None
          LastName = "Patulacci"
      }
      DateOfBith = new DateTime(1850, 12, 25)
      Address = {
          Address1 = "41 av 8 Mai 1945"
          Address2 = None
          City = "Sarcelles"
          State = None
          Zip = "95200"
      }
      PhoneNumber = {
          DialOutCode = 33
          LocalNumber = "766030703"
      }
      Email = "marcel.patulacci@outlook.com"
  }
  
  [&lt;Fact&gt;]
  let ``Open an account...``() =
      let event = Event.AccountOpened({
          AccountId = id
          Contact = contact
      })
  
      let a = [event]
      let b = seq { yield event }
  
      Assert.Equal(a, b)
  </code></pre>