public void NewStatics() { var sharp = new NewSharp(); var root = sharp.GetSquareRoot(16); Assert.That(root, Is.EqualTo(4)); }
public void NewProperties() { var sharp = new NewSharp(); Assert.That(sharp.Name, Is.EqualTo("NoName")); sharp = new NewSharp("Omego2K"); Assert.That(sharp.Name, Is.EqualTo("Omego2K")); Assert.That(sharp.Greeting, Is.EqualTo("Hello Omego2K")); }
public void NewNullCheck() { var sharp = new NewSharp(); var address = sharp.GetCustomerStreetAddressById(1); Assert.That(address, Is.EqualTo("4 Crinan St.")); address = sharp.GetCustomerStreetAddressById(2); Assert.That(address, Is.Null); address = sharp.GetCustomerStreetAddressById(3); Assert.That(address, Is.Null); }
public void NewMethod() { var sharp = new NewSharp(); var product = sharp.GetPercentage(10, 50); Assert.That(product, Is.EqualTo(20)); }
public void NewExtensionMethodCollectionInitializers() { var sharp = new NewSharp(); var customerIdList = sharp.GetCustomerIds(); Assert.That(customerIdList.Count, Is.EqualTo(3)); Assert.That(customerIdList.First.Value, Is.EqualTo(1)); Assert.That(customerIdList.First.Next.Value, Is.EqualTo(2)); Assert.That(customerIdList.Last.Value, Is.EqualTo(3)); }
public async Task NewAwaitInCatchFinallyBlocks() { var sharp = new NewSharp(); var customer = await sharp.GetCustomerByIdAsync(-1); Assert.That(customer, Is.Null); }
public void NewExceptionFiltering() { var sharp = new NewSharp(); var customer = sharp.GetCustomerById(0, false); Assert.That(customer, Is.Null); Assert.Throws<ArgumentException>(() => customer = sharp.GetCustomerById(0, true)); }
public void NewIndexInitializers() { var sharp = new NewSharp(); var dictionary = sharp.GetProducts(); Assert.That(dictionary[Guid.Parse("00000000-0000-0000-0000-000000000001")], Is.EqualTo("Book")); Assert.That(dictionary[Guid.Parse("00000000-0000-0000-0000-000000000002")], Is.EqualTo("Magazine")); Assert.That(dictionary[Guid.Parse("00000000-0000-0000-0000-000000000003")], Is.EqualTo("The blue stuff")); }
public void NewNameToStringHandling() { var sharp = new NewSharp(); var ex = Assert.Throws<ArgumentNullException>(() => sharp.SortString(null)); Assert.That(ex.ParamName, Is.EqualTo("target")); }
public void NewStringFormatting() { var sharp = new NewSharp(); var message = sharp.GetExceptionMessage(ErrorSeverity.Low); Assert.That(message, Is.EqualTo("A Low error has occurred")); }