public void WhenGetReferenceAfterAddReference_ThenDefaultsToValueTypeConverter() { TestReferenceWithoutItsTypeConverter.AddReference(this.element, new Uri("solution://foo/bar.cs")); var uri = TestReferenceWithoutItsTypeConverter.GetReferenceValues(this.element).First(); Assert.NotNull(uri); }
public void WhenConvertFromReference_ThenGetsTypedValue() { var newUri = new Uri("solution://foo/bar.cs"); var reference = TestReferenceWithoutItsTypeConverter.AddReference(this.element, newUri); var typedUri = TestReferenceWithoutItsTypeConverter.FromReference(reference); Assert.Equal(newUri, typedUri); }
public void WhenAddReferenceWithUri_ThenReferenceAdded() { var reference = TestReferenceWithoutItsTypeConverter.AddReference(this.element, new Uri("solution://foo/bar.cs")); Assert.True(this.element.References.Count == 1); Assert.Equal(typeof(TestReferenceWithoutItsTypeConverter).FullName, reference.Kind); Assert.Equal("solution://foo/bar.cs", reference.Value); }
public void WhenSetReferenceWithReferenceInstance_ThenReferenceValueUpdated() { var newUri = new Uri("solution://foo/bar.cs"); var reference = TestReferenceWithoutItsTypeConverter.AddReference(this.element, new Uri("solution://")); TestReferenceWithoutItsTypeConverter.SetReference(reference, newUri); Assert.True(this.element.References.Count == 1); Assert.Equal(typeof(TestReferenceWithoutItsTypeConverter).FullName, reference.Kind); Assert.Equal(newUri.ToString(), reference.Value); Assert.Equal(newUri, TestReferenceWithoutItsTypeConverter.GetReferenceValues(this.element).First()); }
public void WhenGetReferenceWithNullValue_ThenThrows() { Assert.Throws <ArgumentNullException>( () => TestReferenceWithoutItsTypeConverter.GetReference(this.element.Object, null)); }
public void WhenGetReferenceWithNullElement_ThenThrows() { Assert.Throws <ArgumentNullException>( () => TestReferenceWithoutItsTypeConverter.GetReference(null, new Uri("solution://"))); }
public void WhenGetReferenceWithNoReference_ThenNullReturned() { var uri = TestReferenceWithoutItsTypeConverter.GetReferenceValues(this.element).FirstOrDefault(); Assert.Null(uri); }