public void testEnumShort1() { instanceEnumShort = EnumShort.V3; staticEnumShort = EnumShort.V2; var local = EnumShort.V2; AssertTrue(instanceEnumShort == EnumShort.V3); AssertTrue(staticEnumShort == EnumShort.V2); AssertTrue(local == EnumShort.V2); var arr = new EnumShort[1]; arr[0] = EnumShort.V2; AssertTrue(arr[0] == EnumShort.V2); }
public async Task EnumShortTestAsync(EnumShort value) { var collection = MongoDatabase.GetCollection <TestModel>("TestModel"); var testModel = TestModelFactory.GetModel(); await collection.InsertOneAsync(testModel); var result = await collection.UpdateManyAsync(t => t.Id == testModel.Id, () => new TestModel { EnumShort = value }); Assert.Equal(1L, testModel.EnumShort == value ? result.MatchedCount : result.ModifiedCount); var modifyModel = collection.AsQueryable().First(p => p.Id == testModel.Id); Assert.Equal(value, modifyModel.EnumShort); Assert.Equal(1L, (await collection.DeleteOneAsync(t => t.Id == testModel.Id)).DeletedCount); }