public void FullDeckShouldHave52Cards() { Deck deck = new Deck(); Expect.IsNotNull(deck.Cards, "Cards was null"); Expect.AreEqual(52, deck.Cards.Count(), $"Expected 52 cards but there were {deck.Cards.Count()}"); ShowCards(deck); }
public void ShouldBeFullDeckAfterShuffle() { Deck deck = new Deck(); deck.Shuffle(); Expect.AreEqual(52, deck.Cards.Count(), $"Expected 52 cards but there were {deck.Cards.Count()}"); ShowCards(deck); }
public static void AndOperatorShouldParseParens() { TableColumns one = new TableColumns(); QueryFilter <TableColumns> e = one.ColumnOne == "dookey" && one.ColumnTwo == "poo"; Out(e.Parse(), ConsoleColor.Cyan); Expect.AreEqual("([ColumnOne] = @ColumnOne1) AND ([ColumnTwo] = @ColumnTwo2)", e.Parse()); }
public static void EndsWithShouldParseValidWhereExpression() { TableColumns test = new TableColumns(); QueryFilter <TableColumns> e = test.TestOne.EndsWith("gorilla boat"); Out(e.Parse(), ConsoleColor.Cyan); Expect.AreEqual("TestOne LIKE '%' + @TestOne1", e.Parse()); }
public static void OrShouldParseNoParens() { TableColumns one = new TableColumns(); QueryFilter <TableColumns> e = (one.ColumnOne == "monkey").Or(one.ColumnTwo != "banana"); Out(e.Parse(), ConsoleColor.Cyan); Expect.AreEqual("[ColumnOne] = @ColumnOne1 OR [ColumnTwo] <> @ColumnTwo2", e.Parse()); }
public void ShouldDetectGerman() { GetTranslatorAndLanguageDb(out SQLiteDatabase languageDb, out YandexTranslationProvider translator); Language shouldBeGerman = translator.DetectLanguage("Ich mag Affen"); Expect.AreEqual("German", shouldBeGerman.EnglishName); }
public void CanGetDtoForDictionary() { Type dtoType = Dto.TypeFor("TestType", GetTestDictionary()); Expect.IsNotNull(dtoType); Expect.AreEqual(3, dtoType.GetProperties().Length); Pass("dtoTypeFor"); }
public void AppContentNameShouldNotBeNull() { ContentResponder content = new ContentResponder(BamConf.Load(), CreateLogger()); AppContentResponder appContent = new AppContentResponder(content, new AppConf("Monkey")); Expect.IsNotNull(appContent.ApplicationName); Expect.AreEqual("Monkey", appContent.ApplicationName); }
public void TestGetInterfaceMethods() { string methods = string.Join(",", typeof(ITestInterface).GetMethods().Select(m => m.Name)); string spsMethods = string.Join(",", ServiceProxySystem.GetProxiedMethods(typeof(ITestInterface)).Select(m => m.Name)); OutLine(methods); Expect.AreEqual(methods, spsMethods); }
public static void GetColumnsShouldReturnAllColumnAttributeFromType() { ColumnAttribute[] attrs = ColumnAttribute.GetColumns(typeof(ColumnAttributeTestClass)); Expect.AreEqual(2, attrs.Length); Expect.AreEqual("two", attrs[1].Name); Expect.AreEqual("myTable", attrs[1].Table); Expect.AreEqual("SelectDataType", attrs[1].ExtractedType); }
public void GetColumnDataTypeShouldReturnColumnDataType() { GetSchemaExtractors().Each(extractor => { DataTypes dataType = extractor.GetColumnDataType("DaoReferenceObject", "DateTimeProperty"); Expect.AreEqual(DataTypes.DateTime, dataType); }); }
public void SchemaGeneratorShouldWarnAboutMissingKeysIfHasForeignKey() { TypeSchemaGenerator generator = new TypeSchemaGenerator(); SchemaDefinitionCreateResult result = generator.CreateSchemaDefinition(new Type[] { typeof(NoId) }); Expect.IsTrue(result.MissingColumns); Expect.AreEqual(1, result.Warnings.MissingKeyColumns.Length); }
public void UserResolver_ShouldResolveToTestUser() { UserResolvers.Default.Clear(); UserResolvers.Default.AddResolver(new TestUserResolver()); string userName = UserResolvers.Default.GetUser(A.Fake <IHttpContext>()); Expect.AreEqual("TestUser", userName); }
public void UriTest() { Uri uri = new Uri("https://sub.domain.com/path/more"); OutLine(uri.Host); OutLine(uri.Scheme); Expect.AreEqual("sub.domain.com", uri.Host); }
public void _4_ShouldBeAbleToReadVaultInSpecificFile() { FileInfo testFileInfo = new FileInfo(testFile); Vault test = Vault.Load(testFileInfo, "TestVault"); OutLine(test["smtphost"]); Expect.AreEqual("smtp.live.com", test["smtphost"]); }
public void CryptoAesTest() { string encrypted = Crypto.EncryptStringAES("plainText", "password"); string decrypted = Crypto.DecryptStringAES(encrypted, "password"); Expect.AreEqual("plainText", decrypted); encrypted.SafeWriteToFile(".\\cipher.txt", true); }
public void FileWithNoExtensionShouldReturnEmptyString() { string withExtension = "file.txt"; string withoutExtension = "file"; Expect.AreEqual(".txt", Path.GetExtension(withExtension)); Expect.AreEqual(string.Empty, Path.GetExtension(withoutExtension)); }
public void HashingToIntGetsSameInt() { string randomString = 16.RandomLetters(); int hashed = randomString.ToSha1Int(); int again = randomString.ToSha1Int(); OutLine(again.ToString(), ConsoleColor.Cyan); Expect.AreEqual(hashed, again); }
public void TransformTableNameShouldTransformTableName() { GetSchemaExtractors().Each(extractor => { extractor.NameFormatter = new TestNameFormatter(); string className = extractor.GetClassName("Monkey"); Expect.AreEqual("Test_Monkey", className); }); }
public void GetColumnNamesShouldReturnColumnNames() { GetSchemaExtractors().Each(extractor => { string[] columnNames = extractor.GetColumnNames("DaoReferenceObject"); Expect.IsNotNull(columnNames); Expect.AreEqual(9, columnNames.Length); }); }
public void GetTableNamesShouldReturnTableNames() { GetSchemaExtractors().Each(extractor => { string[] tableNames = extractor.GetTableNames(); Expect.IsNotNull(tableNames); Expect.AreEqual(7, tableNames.Length); }); }
public void _4_ShouldBeAbleToReadVaultInSpecificFile() { FileInfo testFileInfo = new FileInfo(testFile); Vault test = Vault.Load(testFileInfo, nameof(_4_ShouldBeAbleToReadVaultInSpecificFile)); test["smtphost"] = "smtp.bamapps.com"; Message.PrintLine(test["smtphost"]); Expect.AreEqual("smtp.bamapps.com", test["smtphost"]); }
public void TagRendersNested() { string expected = @"<div> <span>text</span> </div>"; string actual = new Tag("div", () => new Tag("span", "text")).Render().XmlToHumanReadable(); Expect.AreEqual(expected, actual); }
public void TestGetClrTypeName() { string value = "arrayOf(The.Big.Monkey)"; Expect.AreEqual("Monkey[]", GetClrTypeName(value)); string value2 = "The.Big.Monkey.Banana"; Expect.AreEqual("Banana", GetClrTypeName(value2)); }
public void HashingToLongGetsSameLong() { string randomString = 16.RandomLetters(); long hashed = randomString.ToSha1Long(); long again = randomString.ToSha1Long(); OutLine(again.ToString(), ConsoleColor.Cyan); Expect.AreEqual(hashed, again); }
public void TestGetSizeOf() { Expect.AreEqual(4, SerializableUtil.GetSizeOf(typeof(Int32Type))); Expect.AreEqual(8, SerializableUtil.GetSizeOf(typeof(Int64Type))); Expect.AreEqual(12, SerializableUtil.GetSizeOf(typeof(Int32And64Type))); Expect.AreEqual(13, SerializableUtil.GetSizeOf(typeof(PackedInt32And64Type))); Expect.AreEqual(1, SerializableUtil.GetSizeOf(typeof(ByteType))); }
public static void WriteResultShouldWriteToSpecifiedStream() { MemoryStream stream = new MemoryStream(); TestRazorEngineDaoGenerator gen = new TestRazorEngineDaoGenerator(); string randomString = "".RandomString(8); gen.TestWriteResult(randomString, stream); Expect.AreEqual(randomString, Encoding.UTF8.GetString(stream.GetBuffer().Take(8).ToArray())); }
public void VaultShouldHaveOneKey() { SQLiteDatabase db = GetVaultDatabase(); string password = "******"; Vault v = Vault.Retrieve(db, "EncryptedData", password); Expect.IsGreaterThan(v.VaultKeysByVaultId.Count, 0); Expect.AreEqual(1, v.VaultKeysByVaultId.Count); }
public void JobConductorShouldCreateJobConfWithJobDirectorySet() { string name = MethodBase.GetCurrentMethod().Name; JobConductorService foreman = GetTestJobConductor(name); JobConf conf = foreman.CreateJobConf(name); Expect.AreEqual(name, conf.Name); Expect.IsTrue(conf.JobDirectory.StartsWith(foreman.JobsDirectory), "conf directory wasn't set correctly"); }
public void ShouldGetFksForDto() { TypeSchemaGenerator generator = new TypeSchemaGenerator(); List <Type> oneToManyTypes = generator.GetForeignKeyTypes(typeof(Parent)).ToList().Select(fk => fk.ForeignKeyType).ToList(); Expect.AreEqual(2, oneToManyTypes.Count); Expect.IsTrue(oneToManyTypes.Contains(typeof(Daughter))); Expect.IsTrue(oneToManyTypes.Contains(typeof(Son))); }