﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.ChangeTracking.Tests.Fixture;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Common.ChangeTracking.Tests
{
  [TestClass]
  public class MultipleWrappingTests
  {
    [TestMethod]
    public void AsTrackableAsTrackableTest()
    {
      var foo = new Foo();
      var trackableFoo = foo.AsTrackable().AsTrackable().AsTrackable().AsTrackable();
      trackableFoo.GetType().BaseType.Should().Be(typeof (Foo), "Multiple wrapping detected");
    }

    [TestMethod]
    public void GetTrackableGetTrackableTest()
    {
      var trackedType = ChangeTracker.GetTrackedType(ChangeTracker.GetTrackedType(ChangeTracker.GetTrackedType<Foo>()));
      trackedType.BaseType.Should().Be(typeof(Foo), "Multiple wrapping detected");
    }
  }
}
